@dreamtree-org/twreact-ui 1.0.57

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Partha Preetham
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,620 @@
1
+ # Dreamtree UI
2
+
3
+ A comprehensive React + Tailwind CSS components library for building modern web applications. Built with accessibility, customization, and developer experience in mind.
4
+
5
+ ## Features
6
+
7
+ - 🎨 **Modern Design**: Clean, professional components with Tailwind CSS
8
+ - 🌙 **Dark Mode**: Built-in dark/light mode support
9
+ - ♿ **Accessible**: ARIA compliant with keyboard navigation
10
+ - 📱 **Responsive**: Mobile-first design approach
11
+ - 🎯 **TypeScript Ready**: Full TypeScript support
12
+ - 🧩 **Composable**: Flexible APIs with props, slots, and render functions
13
+ - 🎨 **Customizable**: Easy theming with Tailwind config
14
+ - 📦 **Tree Shakeable**: Import only what you need
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ npm install @dreamtree/twreact-ui
20
+ # or
21
+ yarn add @dreamtree/twreact-ui
22
+ ```
23
+
24
+ ## Quick Start
25
+
26
+ ```jsx
27
+ import { Button, Input, Card } from '@dreamtree/twreact-ui';
28
+
29
+ function App() {
30
+ return (
31
+ <div className="p-4">
32
+ <Card>
33
+ <Card.Header>
34
+ <Card.Title>Welcome to Dreamtree UI</Card.Title>
35
+ </Card.Header>
36
+ <Card.Content>
37
+ <Input placeholder="Enter your name" />
38
+ <Button className="mt-4">Get Started</Button>
39
+ </Card.Content>
40
+ </Card>
41
+ </div>
42
+ );
43
+ }
44
+ ```
45
+
46
+ ## Components
47
+
48
+ ### Core Components
49
+
50
+ #### Button
51
+ Versatile button component with multiple variants and states.
52
+
53
+ **Props:**
54
+ - `variant`: 'primary' | 'secondary' | 'outline' | 'ghost' | 'destructive' | 'success' | 'warning' (default: 'primary')
55
+ - `size`: 'sm' | 'md' | 'lg' (default: 'md')
56
+ - `disabled`: boolean
57
+ - `loading`: boolean
58
+ - `leftIcon`: ReactNode
59
+ - `rightIcon`: ReactNode
60
+ - `fullWidth`: boolean
61
+ - `className`: string
62
+
63
+ ```jsx
64
+ <Button variant="primary" size="lg" loading>
65
+ Loading...
66
+ </Button>
67
+ ```
68
+
69
+ #### Input
70
+ Enhanced text input with validation states, icons, and clear functionality.
71
+
72
+ **Props:**
73
+ - `type`: 'text' | 'password' | 'email' | 'search' | 'number' | 'tel' | 'url'
74
+ - `variant`: 'default' | 'filled' | 'outlined'
75
+ - `size`: 'sm' | 'md' | 'lg' (default: 'md')
76
+ - `label`: string
77
+ - `placeholder`: string
78
+ - `error`: string
79
+ - `success`: string
80
+ - `disabled`: boolean
81
+ - `required`: boolean
82
+ - `clearable`: boolean
83
+ - `icon`: ReactNode
84
+ - `iconPosition`: 'left' | 'right' (default: 'left')
85
+ - `showCount`: boolean
86
+ - `maxLength`: number
87
+ - `readOnly`: boolean
88
+ - `onClear`: () => void
89
+
90
+ ```jsx
91
+ <Input
92
+ type="email"
93
+ label="Email Address"
94
+ placeholder="Enter your email"
95
+ error="Please enter a valid email"
96
+ clearable
97
+ required
98
+ />
99
+ ```
100
+
101
+ #### Select
102
+ Advanced select component with search, multi-select, and grouping support.
103
+
104
+ **Props:**
105
+ - `options`: Array<{value: any, label: string, disabled?: boolean}>
106
+ - `value`: any | Array<any>
107
+ - `onChange`: (value: any) => void
108
+ - `placeholder`: string (default: 'Select an option...')
109
+ - `label`: string
110
+ - `error`: string
111
+ - `disabled`: boolean
112
+ - `required`: boolean
113
+ - `multiSelect`: boolean
114
+ - `searchable`: boolean
115
+ - `grouped`: boolean
116
+ - `creatable`: boolean
117
+ - `onCreateOption`: (value: string) => void
118
+ - `onSearch`: (term: string) => void
119
+ - `loading`: boolean
120
+ - `selectAllOption`: boolean
121
+ - `closeOnSelect`: boolean
122
+ - `maxTagCount`: number (default: 3)
123
+ - `allowClear`: boolean
124
+
125
+ ```jsx
126
+ <Select
127
+ options={[
128
+ { value: 'us', label: 'United States' },
129
+ { value: 'ca', label: 'Canada' }
130
+ ]}
131
+ multiSelect
132
+ searchable
133
+ placeholder="Choose countries"
134
+ />
135
+ ```
136
+
137
+ #### Form
138
+ Declarative form builder with validation support.
139
+
140
+ **Props:**
141
+ - `fields`: Array<FormField>
142
+ - `onSubmit`: (data: any) => void
143
+ - `defaultValues`: object
144
+ - `validationSchema`: any
145
+ - `submitText`: string (default: 'Submit')
146
+ - `resetText`: string (default: 'Reset')
147
+ - `showReset`: boolean (default: true)
148
+
149
+ ```jsx
150
+ const formFields = [
151
+ {
152
+ type: 'text',
153
+ name: 'firstName',
154
+ label: 'First Name',
155
+ required: true,
156
+ placeholder: 'Enter your first name'
157
+ },
158
+ {
159
+ type: 'email',
160
+ name: 'email',
161
+ label: 'Email',
162
+ required: true
163
+ }
164
+ ];
165
+
166
+ <Form
167
+ fields={formFields}
168
+ onSubmit={(data) => console.log(data)}
169
+ submitText="Create Account"
170
+ />
171
+ ```
172
+
173
+ #### Table
174
+ Feature-rich data table with sorting, filtering, and pagination.
175
+
176
+ **Props:**
177
+ - `data`: Array<object>
178
+ - `columns`: Array<Column>
179
+ - `sortable`: boolean (default: true)
180
+ - `filterable`: boolean
181
+ - `selectable`: boolean
182
+ - `pagination`: boolean
183
+ - `pageSize`: number (default: 10)
184
+ - `onSort`: (key: string, direction: 'asc' | 'desc') => void
185
+ - `onFilter`: (filters: object) => void
186
+ - `onSelectionChange`: (selectedRows: Set<any>) => void
187
+ - `onRowClick`: (row: object) => void
188
+ - `hasDetails`: boolean
189
+ - `DetailsComponent`: ReactComponent
190
+ - `withAction`: boolean
191
+ - `onAction`: (action: string, row: object) => void
192
+ - `actions`: Array<Action>
193
+ - `showSerial`: boolean (default: true)
194
+
195
+ ```jsx
196
+ const columns = [
197
+ { key: 'name', label: 'Name', sortable: true },
198
+ { key: 'email', label: 'Email', sortable: true },
199
+ { key: 'role', label: 'Role' }
200
+ ];
201
+
202
+ <Table
203
+ columns={columns}
204
+ data={users}
205
+ sortable
206
+ filterable
207
+ pagination
208
+ pageSize={10}
209
+ />
210
+ ```
211
+
212
+ #### DatePicker
213
+ Calendar-based date selection with keyboard navigation.
214
+
215
+ **Props:**
216
+ - `value`: Date | string
217
+ - `onChange`: (date: Date | null) => void
218
+ - `placeholder`: string (default: 'Select date...')
219
+ - `label`: string
220
+ - `error`: string
221
+ - `disabled`: boolean
222
+ - `required`: boolean
223
+ - `minDate`: Date | string
224
+ - `maxDate`: Date | string
225
+ - `weekStartsOn`: 0 | 1 (default: 0)
226
+ - `portal`: boolean
227
+ - `displayFormat`: string (default: 'MMM dd, yyyy')
228
+ - `locale`: Locale
229
+ - `showClear`: boolean (default: true)
230
+ - `closeOnSelect`: boolean (default: true)
231
+
232
+ ```jsx
233
+ <DatePicker
234
+ label="Birth Date"
235
+ minDate={new Date('1900-01-01')}
236
+ maxDate={new Date()}
237
+ placeholder="Select your birth date"
238
+ />
239
+ ```
240
+
241
+ ### Navigation Components
242
+
243
+ #### Sidebar
244
+ Collapsible sidebar navigation with nested items.
245
+
246
+ **Props:**
247
+ - `items`: Array<SidebarItem>
248
+ - `collapsed`: boolean (default: false)
249
+ - `onToggle`: () => void
250
+ - `logo`: ReactNode
251
+ - `user`: {name: string, email: string, avatar?: string, menuItems?: Array<MenuItem>}
252
+ - `onUserClick`: (user: object) => void
253
+
254
+ ```jsx
255
+ const sidebarItems = [
256
+ {
257
+ id: 'dashboard',
258
+ label: 'Dashboard',
259
+ icon: <Home className="h-4 w-4" />,
260
+ active: true
261
+ },
262
+ {
263
+ id: 'users',
264
+ label: 'Users',
265
+ icon: <Users className="h-4 w-4" />,
266
+ children: [
267
+ { id: 'all-users', label: 'All Users' },
268
+ { id: 'new-user', label: 'Add New User' }
269
+ ]
270
+ }
271
+ ];
272
+
273
+ <Sidebar
274
+ items={sidebarItems}
275
+ logo={<div className="text-xl font-bold">Dreamtree</div>}
276
+ user={{ name: 'John Doe', email: 'john@example.com' }}
277
+ />
278
+ ```
279
+
280
+ #### Navbar
281
+ Top navigation bar with user menu and notifications.
282
+
283
+ **Props:**
284
+ - `logo`: ReactNode
285
+ - `items`: Array<NavItem>
286
+ - `user`: {name: string, email: string, avatar?: string, menuItems?: Array<MenuItem>}
287
+ - `notifications`: Array<Notification>
288
+ - `searchable`: boolean
289
+ - `onSearch`: (term: string) => void
290
+ - `onNotificationClick`: (notifications: Array<Notification>) => void
291
+ - `onUserClick`: (user: object) => void
292
+ - `leftIcon`: ReactNode | false
293
+ - `onLeftIconClick`: () => void
294
+
295
+ ```jsx
296
+ <Navbar
297
+ logo={<div className="text-xl font-bold">Dreamtree</div>}
298
+ items={navItems}
299
+ user={user}
300
+ notifications={notifications}
301
+ searchable
302
+ onSearch={(term) => console.log(term)}
303
+ />
304
+ ```
305
+
306
+ ### Feedback Components
307
+
308
+ #### Alert
309
+ Status messages and notifications with different variants.
310
+
311
+ **Props:**
312
+ - `variant`: 'success' | 'error' | 'warning' | 'info' (default: 'info')
313
+ - `title`: string
314
+ - `children`: ReactNode
315
+ - `dismissible`: boolean
316
+ - `onDismiss`: () => void
317
+
318
+ ```jsx
319
+ <Alert variant="success" title="Success!" dismissible>
320
+ Your changes have been saved successfully.
321
+ </Alert>
322
+ ```
323
+
324
+ #### Toast
325
+ Notification messages with different types and positions.
326
+
327
+ **Props:**
328
+ - `id`: string
329
+ - `title`: string
330
+ - `message`: string
331
+ - `type`: 'success' | 'error' | 'warning' | 'info' (default: 'info')
332
+ - `duration`: number (default: 5000)
333
+ - `onClose`: (id: string) => void
334
+ - `position`: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center'
335
+
336
+ ```jsx
337
+ import { useToast, ToastContainer } from 'dreamtree-ui';
338
+
339
+ function App() {
340
+ const { toast, toasts, removeToast } = useToast();
341
+
342
+ const showSuccess = () => {
343
+ toast.success('Success!', 'Your changes have been saved.');
344
+ };
345
+
346
+ return (
347
+ <div>
348
+ <button onClick={showSuccess}>Show Success</button>
349
+ <ToastContainer toasts={toasts} onRemove={removeToast} />
350
+ </div>
351
+ );
352
+ }
353
+ ```
354
+
355
+ ### Utility Components
356
+
357
+ #### Card
358
+ Content containers with header, body, and footer sections.
359
+
360
+ **Props:**
361
+ - `children`: ReactNode
362
+ - `hover`: boolean
363
+ - `className`: string
364
+
365
+ ```jsx
366
+ <Card hover>
367
+ <Card.Header>
368
+ <Card.Title>Card Title</Card.Title>
369
+ <Card.Description>Card description</Card.Description>
370
+ </Card.Header>
371
+ <Card.Content>
372
+ Card content goes here
373
+ </Card.Content>
374
+ <Card.Footer>
375
+ <Button>Action</Button>
376
+ </Card.Footer>
377
+ </Card>
378
+ ```
379
+
380
+ #### Avatar
381
+ User profile images with fallbacks and status indicators.
382
+
383
+ **Props:**
384
+ - `src`: string
385
+ - `alt`: string
386
+ - `name`: string
387
+ - `size`: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' (default: 'md')
388
+ - `shape`: 'circle' | 'square' | 'rounded' (default: 'circle')
389
+ - `status`: 'online' | 'offline' | 'away' | 'busy'
390
+
391
+ ```jsx
392
+ <Avatar
393
+ src="https://example.com/avatar.jpg"
394
+ name="John Doe"
395
+ size="lg"
396
+ status="online"
397
+ />
398
+ ```
399
+
400
+ #### Badge
401
+ Status indicators and labels with different variants.
402
+
403
+ **Props:**
404
+ - `children`: ReactNode
405
+ - `variant`: 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'outline' (default: 'default')
406
+ - `size`: 'sm' | 'md' | 'lg' (default: 'md')
407
+ - `rounded`: boolean (default: true)
408
+
409
+ ```jsx
410
+ <Badge variant="success" size="sm">
411
+ Active
412
+ </Badge>
413
+ ```
414
+
415
+ #### Tabs
416
+ Tabbed content organization with different styles.
417
+
418
+ **Props:**
419
+ - `items`: Array<{id: string, label: string, content: ReactNode, icon?: ReactNode, badge?: string}>
420
+ - `defaultActiveTab`: string
421
+ - `orientation`: 'horizontal' | 'vertical' (default: 'horizontal')
422
+ - `variant`: 'default' | 'pills' | 'underline' (default: 'default')
423
+ - `onTabChange`: (tabId: string) => void
424
+
425
+ ```jsx
426
+ const tabItems = [
427
+ {
428
+ id: 'overview',
429
+ label: 'Overview',
430
+ content: <div>Overview content</div>
431
+ },
432
+ {
433
+ id: 'settings',
434
+ label: 'Settings',
435
+ content: <div>Settings content</div>
436
+ }
437
+ ];
438
+
439
+ <Tabs items={tabItems} variant="pills" />
440
+ ```
441
+
442
+ ## Theming
443
+
444
+ Dreamtree UI supports custom theming through Tailwind CSS configuration:
445
+
446
+ ```js
447
+ // tailwind.config.js
448
+ module.exports = {
449
+ theme: {
450
+ extend: {
451
+ colors: {
452
+ primary: {
453
+ 50: '#eff6ff',
454
+ 100: '#dbeafe',
455
+ 500: '#3b82f6',
456
+ 600: '#2563eb',
457
+ 700: '#1d4ed8',
458
+ },
459
+ success: {
460
+ 50: '#f0fdf4',
461
+ 100: '#dcfce7',
462
+ 500: '#22c55e',
463
+ 600: '#16a34a',
464
+ },
465
+ error: {
466
+ 50: '#fef2f2',
467
+ 100: '#fee2e2',
468
+ 500: '#ef4444',
469
+ 600: '#dc2626',
470
+ },
471
+ warning: {
472
+ 50: '#fffbeb',
473
+ 100: '#fef3c7',
474
+ 500: '#f59e0b',
475
+ 600: '#d97706',
476
+ }
477
+ }
478
+ }
479
+ }
480
+ }
481
+ ```
482
+
483
+ ## Dark Mode
484
+
485
+ Enable dark mode with the built-in theme provider:
486
+
487
+ ```jsx
488
+ import { ThemeProvider } from 'dreamtree-ui';
489
+
490
+ function App() {
491
+ return (
492
+ <ThemeProvider defaultTheme="dark">
493
+ {/* Your app content */}
494
+ </ThemeProvider>
495
+ );
496
+ }
497
+ ```
498
+
499
+ ## Examples
500
+
501
+ ### Complete Form Example
502
+
503
+ ```jsx
504
+ import { Form, Button, Card } from 'dreamtree-ui';
505
+
506
+ const formFields = [
507
+ {
508
+ type: 'text',
509
+ name: 'firstName',
510
+ label: 'First Name',
511
+ required: true,
512
+ placeholder: 'Enter your first name'
513
+ },
514
+ {
515
+ type: 'email',
516
+ name: 'email',
517
+ label: 'Email',
518
+ required: true,
519
+ placeholder: 'Enter your email'
520
+ },
521
+ {
522
+ type: 'select',
523
+ name: 'country',
524
+ label: 'Country',
525
+ options: [
526
+ { value: 'us', label: 'United States' },
527
+ { value: 'ca', label: 'Canada' }
528
+ ]
529
+ }
530
+ ];
531
+
532
+ function ContactForm() {
533
+ const handleSubmit = (data) => {
534
+ console.log('Form data:', data);
535
+ };
536
+
537
+ return (
538
+ <Card>
539
+ <Card.Header>
540
+ <Card.Title>Contact Information</Card.Title>
541
+ <Card.Description>Please fill out the form below</Card.Description>
542
+ </Card.Header>
543
+ <Card.Content>
544
+ <Form
545
+ fields={formFields}
546
+ onSubmit={handleSubmit}
547
+ submitText="Send Message"
548
+ />
549
+ </Card.Content>
550
+ </Card>
551
+ );
552
+ }
553
+ ```
554
+
555
+ ### Data Table with Actions
556
+
557
+ ```jsx
558
+ import { Table, Button, Badge } from 'dreamtree-ui';
559
+
560
+ const columns = [
561
+ { key: 'name', label: 'Name', sortable: true },
562
+ { key: 'email', label: 'Email', sortable: true },
563
+ { key: 'status', label: 'Status' }
564
+ ];
565
+
566
+ const data = [
567
+ {
568
+ id: 1,
569
+ name: 'John Doe',
570
+ email: 'john@example.com',
571
+ status: 'Active'
572
+ },
573
+ {
574
+ id: 2,
575
+ name: 'Jane Smith',
576
+ email: 'jane@example.com',
577
+ status: 'Inactive'
578
+ }
579
+ ];
580
+
581
+ const actions = [
582
+ {
583
+ label: 'Edit',
584
+ onClick: (row) => console.log('Edit', row)
585
+ },
586
+ {
587
+ label: 'Delete',
588
+ onClick: (row) => console.log('Delete', row),
589
+ variant: 'destructive'
590
+ }
591
+ ];
592
+
593
+ function UserTable() {
594
+ return (
595
+ <Table
596
+ columns={columns}
597
+ data={data}
598
+ sortable
599
+ filterable
600
+ pagination
601
+ pageSize={10}
602
+ actions={actions}
603
+ />
604
+ );
605
+ }
606
+ ```
607
+
608
+ ## Contributing
609
+
610
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
611
+
612
+ ## License
613
+
614
+ MIT License - see [LICENSE](LICENSE) for details.
615
+
616
+ ## Support
617
+
618
+ - 📖 [Documentation](https://dreamtree-ui.dev)
619
+ - 🐛 [Issue Tracker](https://github.com/dreamtree-ui/dreamtree-ui/issues)
620
+ - 💬 [Discussions](https://github.com/dreamtree-ui/dreamtree-ui/discussions)
package/dist/README.md ADDED
@@ -0,0 +1,237 @@
1
+ # Dreamtree UI
2
+
3
+ A comprehensive React + Tailwind CSS components library for building modern web applications. Built with accessibility, customization, and developer experience in mind.
4
+
5
+ ## Features
6
+
7
+ - 🎨 **Modern Design**: Clean, professional components with Tailwind CSS
8
+ - 🌙 **Dark Mode**: Built-in dark/light mode support
9
+ - ♿ **Accessible**: ARIA compliant with keyboard navigation
10
+ - 📱 **Responsive**: Mobile-first design approach
11
+ - 🎯 **TypeScript Ready**: Full TypeScript support
12
+ - 🧩 **Composable**: Flexible APIs with props, slots, and render functions
13
+ - 🎨 **Customizable**: Easy theming with Tailwind config
14
+ - 📦 **Tree Shakeable**: Import only what you need
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ npm install dreamtree-ui
20
+ # or
21
+ yarn add dreamtree-ui
22
+ ```
23
+
24
+ ## Quick Start
25
+
26
+ ```jsx
27
+ import { Button, Input, Card } from 'dreamtree-ui';
28
+
29
+ function App() {
30
+ return (
31
+ <div className="p-4">
32
+ <Card>
33
+ <Card.Header>
34
+ <Card.Title>Welcome to Dreamtree UI</Card.Title>
35
+ </Card.Header>
36
+ <Card.Content>
37
+ <Input placeholder="Enter your name" />
38
+ <Button className="mt-4">Get Started</Button>
39
+ </Card.Content>
40
+ </Card>
41
+ </div>
42
+ );
43
+ }
44
+ ```
45
+
46
+ ## Components
47
+
48
+ ### Core Components
49
+
50
+ - **Input** - Text inputs with validation states, icons, and clear functionality
51
+ - **Button** - Various button styles and states
52
+ - **Select** - Dropdown select with search, multi-select, and grouping
53
+ - **DatePicker** - Calendar-based date selection
54
+ - **Table** - Data tables with sorting, filtering, and pagination
55
+ - **Form** - Declarative form builder with validation
56
+
57
+ ### Navigation
58
+
59
+ - **Sidebar** - Collapsible sidebar navigation
60
+ - **Navbar** - Top navigation bar with user menu
61
+ - **FootNav** - Mobile bottom navigation
62
+ - **Breadcrumbs** - Page hierarchy navigation
63
+
64
+ ### Feedback & Overlay
65
+
66
+ - **Dialog** - Modal dialogs with customizable sizes
67
+ - **Toast** - Notification messages with different types
68
+ - **Tooltip** - Contextual help text
69
+ - **Alert** - Status messages and notifications
70
+ - **Loader** - Loading states and skeletons
71
+
72
+ ### Utility Components
73
+
74
+ - **Tabs** - Tabbed content organization
75
+ - **Accordion** - Collapsible content sections
76
+ - **Badge** - Status indicators and labels
77
+ - **Avatar** - User profile images with fallbacks
78
+ - **Card** - Content containers with header/body/footer
79
+ - **Pagination** - Page navigation controls
80
+ - **Stepper** - Step-by-step process indicators
81
+ - **FileUpload** - Drag & drop file upload with preview
82
+
83
+ ## Theming
84
+
85
+ Dreamtree UI supports custom theming through Tailwind CSS configuration:
86
+
87
+ ```js
88
+ // tailwind.config.js
89
+ module.exports = {
90
+ theme: {
91
+ extend: {
92
+ colors: {
93
+ primary: {
94
+ 50: '#eff6ff',
95
+ 500: '#3b82f6',
96
+ 600: '#2563eb',
97
+ // ... your custom colors
98
+ }
99
+ }
100
+ }
101
+ }
102
+ }
103
+ ```
104
+
105
+ ## Dark Mode
106
+
107
+ Enable dark mode with the built-in theme provider:
108
+
109
+ ```jsx
110
+ import { ThemeProvider } from 'dreamtree-ui';
111
+
112
+ function App() {
113
+ return (
114
+ <ThemeProvider defaultTheme="dark">
115
+ {/* Your app content */}
116
+ </ThemeProvider>
117
+ );
118
+ }
119
+ ```
120
+
121
+ ## Examples
122
+
123
+ ### Form with Validation
124
+
125
+ ```jsx
126
+ import { Form } from 'dreamtree-ui';
127
+
128
+ const formFields = [
129
+ {
130
+ type: 'text',
131
+ name: 'firstName',
132
+ label: 'First Name',
133
+ required: true,
134
+ placeholder: 'Enter your first name'
135
+ },
136
+ {
137
+ type: 'email',
138
+ name: 'email',
139
+ label: 'Email',
140
+ required: true,
141
+ placeholder: 'Enter your email'
142
+ },
143
+ {
144
+ type: 'select',
145
+ name: 'country',
146
+ label: 'Country',
147
+ options: [
148
+ { value: 'us', label: 'United States' },
149
+ { value: 'ca', label: 'Canada' }
150
+ ]
151
+ }
152
+ ];
153
+
154
+ function ContactForm() {
155
+ const handleSubmit = (data) => {
156
+ console.log('Form data:', data);
157
+ };
158
+
159
+ return (
160
+ <Form
161
+ fields={formFields}
162
+ onSubmit={handleSubmit}
163
+ submitText="Send Message"
164
+ />
165
+ );
166
+ }
167
+ ```
168
+
169
+ ### Data Table
170
+
171
+ ```jsx
172
+ import { Table } from 'dreamtree-ui';
173
+
174
+ const columns = [
175
+ { key: 'name', label: 'Name', sortable: true },
176
+ { key: 'email', label: 'Email', sortable: true },
177
+ { key: 'role', label: 'Role' }
178
+ ];
179
+
180
+ const data = [
181
+ { name: 'John Doe', email: 'john@example.com', role: 'Admin' },
182
+ { name: 'Jane Smith', email: 'jane@example.com', role: 'User' }
183
+ ];
184
+
185
+ function UserTable() {
186
+ return (
187
+ <Table
188
+ columns={columns}
189
+ data={data}
190
+ sortable
191
+ filterable
192
+ pagination
193
+ pageSize={10}
194
+ />
195
+ );
196
+ }
197
+ ```
198
+
199
+ ### Toast Notifications
200
+
201
+ ```jsx
202
+ import { useToast, ToastContainer } from 'dreamtree-ui';
203
+
204
+ function App() {
205
+ const { toast, toasts, removeToast } = useToast();
206
+
207
+ const showSuccess = () => {
208
+ toast.success('Success!', 'Your changes have been saved.');
209
+ };
210
+
211
+ const showError = () => {
212
+ toast.error('Error!', 'Something went wrong.');
213
+ };
214
+
215
+ return (
216
+ <div>
217
+ <button onClick={showSuccess}>Show Success</button>
218
+ <button onClick={showError}>Show Error</button>
219
+ <ToastContainer toasts={toasts} onRemove={removeToast} />
220
+ </div>
221
+ );
222
+ }
223
+ ```
224
+
225
+ ## Contributing
226
+
227
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
228
+
229
+ ## License
230
+
231
+ MIT License - see [LICENSE](LICENSE) for details.
232
+
233
+ ## Support
234
+
235
+ - 📖 [Documentation](https://dreamtree-ui.dev)
236
+ - 🐛 [Issue Tracker](https://github.com/dreamtree-ui/dreamtree-ui/issues)
237
+ - 💬 [Discussions](https://github.com/dreamtree-ui/dreamtree-ui/discussions)
@@ -0,0 +1,110 @@
1
+ {
2
+ "name": "@preethamkrishna/twreact-ui",
3
+ "version": "1.0.10",
4
+ "description": "A comprehensive React + Tailwind components library for building modern web apps",
5
+ "author": {
6
+ "name": "Partha Preetham Krishna",
7
+ "email": "partha.preetham.krishna@gmail.com",
8
+ "url": "https://www.linkedin.com/in/partha-preetham-krishna-68ba00197/"
9
+ },
10
+ "main": "dist/index.js",
11
+ "module": "dist/index.esm.js",
12
+ "files": [
13
+ "dist",
14
+ "package.json",
15
+ "README.md"
16
+ ],
17
+ "scripts": {
18
+ "build": "node scripts/version-bump.js && NODE_ENV=production rollup -c && cp package.json dist/ && cp README.md dist/",
19
+ "dev": "rollup -c -w",
20
+ "test": "jest",
21
+ "lint": "eslint src --ext .js,.jsx",
22
+ "lint:fix": "eslint src --ext .js,.jsx --fix",
23
+ "preview": "npm run build && npx serve dist -p 3000",
24
+ "demo": "npx serve demo -p 3000",
25
+ "storybook": "storybook dev -p 6006",
26
+ "build-storybook": "storybook build",
27
+ "version:patch": "npm version patch && git push && git push --tags",
28
+ "version:minor": "npm version minor && git push && git push --tags",
29
+ "version:major": "npm version major && git push && git push --tags",
30
+ "version:prerelease": "npm version prerelease && git push && git push --tags",
31
+ "version:prepatch": "npm version prepatch && git push && git push --tags",
32
+ "version:preminor": "npm version preminor && git push && git push --tags",
33
+ "version:premajor": "npm version premajor && git push && git push --tags",
34
+ "release": "npm run build && npm run test && npm run lint",
35
+ "release:patch": "npm run release && npm run version:patch",
36
+ "release:minor": "npm run release && npm run version:minor",
37
+ "release:major": "npm run release && npm run version:major",
38
+ "release:prerelease": "npm run release && npm run version:prerelease",
39
+ "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
40
+ "changelog:all": "conventional-changelog -p angular -i CHANGELOG.md -s",
41
+ "prepare": "husky"
42
+ },
43
+ "keywords": [
44
+ "react",
45
+ "tailwind",
46
+ "ui",
47
+ "components",
48
+ "javascript",
49
+ "design-system"
50
+ ],
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "git+https://github.com/preethamkrishnadev/dreamtree-ui.git"
54
+ },
55
+ "bugs": {
56
+ "url": "https://github.com/preethamkrishnadev/dreamtree-ui/issues"
57
+ },
58
+ "homepage": "https://github.com/preethamkrishnadev/dreamtree-ui#readme",
59
+ "license": "MIT",
60
+ "peerDependencies": {
61
+ "react": ">=16.8.0",
62
+ "react-dom": ">=16.8.0"
63
+ },
64
+ "dependencies": {
65
+ "@hookform/resolvers": "^3.1.1",
66
+ "clsx": "^1.2.1",
67
+ "date-fns": "^2.30.0",
68
+ "lucide-react": "^0.263.1",
69
+ "react-hook-form": "^7.45.4",
70
+ "tailwind-merge": "^1.14.0",
71
+ "zod": "^3.21.4"
72
+ },
73
+ "devDependencies": {
74
+ "@babel/plugin-transform-runtime": "^7.28.3",
75
+ "@babel/preset-env": "^7.28.3",
76
+ "@babel/preset-react": "^7.27.1",
77
+ "@babel/runtime": "^7.28.4",
78
+ "@commitlint/cli": "^19.8.1",
79
+ "@commitlint/config-conventional": "^19.8.1",
80
+ "@rollup/plugin-babel": "^6.0.4",
81
+ "@rollup/plugin-commonjs": "^25.0.7",
82
+ "@rollup/plugin-node-resolve": "^15.2.3",
83
+ "@storybook/addon-essentials": "^7.6.17",
84
+ "@storybook/addon-interactions": "^7.6.17",
85
+ "@storybook/addon-links": "^7.6.17",
86
+ "@storybook/blocks": "^7.6.17",
87
+ "@storybook/react": "^7.6.17",
88
+ "@storybook/react-vite": "^7.6.17",
89
+ "@testing-library/jest-dom": "^6.1.4",
90
+ "@testing-library/react": "^13.4.0",
91
+ "@testing-library/user-event": "^14.5.1",
92
+ "autoprefixer": "^10.4.16",
93
+ "babel-preset-react-app": "^10.0.1",
94
+ "conventional-changelog-cli": "^5.0.0",
95
+ "eslint": "^8.53.0",
96
+ "eslint-plugin-react": "^7.33.2",
97
+ "eslint-plugin-react-hooks": "^4.6.0",
98
+ "husky": "^9.1.7",
99
+ "jest": "^29.7.0",
100
+ "jest-environment-jsdom": "^29.7.0",
101
+ "postcss": "^8.4.31",
102
+ "rollup": "^4.6.1",
103
+ "rollup-plugin-peer-deps-external": "^2.2.4",
104
+ "rollup-plugin-postcss": "^4.0.2",
105
+ "serve": "^14.2.1",
106
+ "storybook": "^7.6.17",
107
+ "tailwindcss": "^3.3.5",
108
+ "vite": "^4.5.0"
109
+ }
110
+ }
package/package.json ADDED
@@ -0,0 +1,114 @@
1
+ {
2
+ "name": "@dreamtree-org/twreact-ui",
3
+ "version": "1.0.57",
4
+ "description": "A comprehensive React + Tailwind components library for building modern web apps",
5
+ "author": {
6
+ "name": "Partha Preetham Krishna",
7
+ "email": "partha.preetham.krishna@gmail.com",
8
+ "url": "https://www.linkedin.com/in/partha-preetham-krishna-68ba00197/"
9
+ },
10
+ "main": "dist/index.js",
11
+ "module": "dist/index.esm.js",
12
+ "files": [
13
+ "dist",
14
+ "package.json",
15
+ "README.md"
16
+ ],
17
+ "scripts": {
18
+ "build": "node scripts/version-bump.js && NODE_ENV=production rollup -c",
19
+ "dev": "NODE_ENV=development rollup -c -w",
20
+ "test": "jest",
21
+ "test:watch": "jest --watch",
22
+ "test:coverage": "jest --coverage",
23
+ "lint": "eslint src --ext .js,.jsx",
24
+ "lint:fix": "eslint src --ext .js,.jsx --fix",
25
+ "preview": "npm run build && npx serve dist -p 3000",
26
+ "demo": "npx serve demo -p 3000",
27
+ "storybook": "storybook dev -p 6006",
28
+ "build-storybook": "storybook build",
29
+ "version:patch": "npm version patch && git push && git push --tags",
30
+ "version:minor": "npm version minor && git push && git push --tags",
31
+ "version:major": "npm version major && git push && git push --tags",
32
+ "version:prerelease": "npm version prerelease && git push && git push --tags",
33
+ "version:prepatch": "npm version prepatch && git push && git push --tags",
34
+ "version:preminor": "npm version preminor && git push && git push --tags",
35
+ "version:premajor": "npm version premajor && git push && git push --tags",
36
+ "release": "npm run build && npm run test && npm run lint",
37
+ "release:patch": "npm run release && npm run version:patch",
38
+ "release:minor": "npm run release && npm run version:minor",
39
+ "release:major": "npm run release && npm run version:major",
40
+ "release:prerelease": "npm run release && npm run version:prerelease"
41
+ },
42
+ "keywords": [
43
+ "react",
44
+ "tailwind",
45
+ "ui",
46
+ "components",
47
+ "javascript",
48
+ "design-system"
49
+ ],
50
+ "repository": {
51
+ "type": "git",
52
+ "url": "git+https://github.com/preethamkrishnadev/dreamtree-ui.git"
53
+ },
54
+ "bugs": {
55
+ "url": "https://github.com/preethamkrishnadev/dreamtree-ui/issues"
56
+ },
57
+ "homepage": "https://github.com/preethamkrishnadev/dreamtree-ui#readme",
58
+ "license": "MIT",
59
+ "peerDependencies": {
60
+ "react": "^18.3.1",
61
+ "react-dom": "^18.3.1"
62
+ },
63
+ "dependencies": {
64
+ "@hookform/resolvers": "^3.1.1",
65
+ "@reduxjs/toolkit": "^2.9.0",
66
+ "axios": "^1.12.2",
67
+ "clsx": "^1.2.1",
68
+ "date-fns": "^2.30.0",
69
+ "lucide-react": "^0.263.1",
70
+ "react-hook-form": "^7.45.4",
71
+ "react-redux": "^9.2.0",
72
+ "react-responsive": "^10.0.1",
73
+ "redux-persist": "^6.0.0",
74
+ "tailwind-merge": "^1.14.0",
75
+ "yup": "^1.7.1"
76
+ },
77
+ "devDependencies": {
78
+ "@babel/plugin-transform-runtime": "^7.28.3",
79
+ "@babel/preset-env": "^7.28.3",
80
+ "@babel/preset-react": "^7.27.1",
81
+ "@babel/runtime": "^7.28.4",
82
+ "@rollup/plugin-babel": "^6.0.4",
83
+ "@rollup/plugin-commonjs": "^25.0.7",
84
+ "@rollup/plugin-node-resolve": "^15.2.3",
85
+ "@storybook/addon-essentials": "^7.6.17",
86
+ "@storybook/addon-interactions": "^7.6.17",
87
+ "@storybook/addon-links": "^7.6.17",
88
+ "@storybook/blocks": "^7.6.17",
89
+ "@storybook/react": "^7.6.17",
90
+ "@storybook/react-vite": "^7.6.17",
91
+ "@testing-library/jest-dom": "^6.1.4",
92
+ "@testing-library/react": "^13.4.0",
93
+ "@testing-library/user-event": "^14.5.1",
94
+ "autoprefixer": "^10.4.16",
95
+ "babel-jest": "^29.7.0",
96
+ "eslint": "^8.53.0",
97
+ "eslint-plugin-react": "^7.33.2",
98
+ "eslint-plugin-react-hooks": "^4.6.0",
99
+ "identity-obj-proxy": "^3.0.0",
100
+ "jest": "^29.7.0",
101
+ "jest-environment-jsdom": "^29.7.0",
102
+ "jest-transform-stub": "^2.0.0",
103
+ "postcss": "^8.4.31",
104
+ "react": "^18.3.1",
105
+ "react-dom": "^18.3.1",
106
+ "rollup": "^4.53.3",
107
+ "rollup-plugin-peer-deps-external": "^2.2.4",
108
+ "rollup-plugin-postcss": "^4.0.2",
109
+ "serve": "^14.2.1",
110
+ "storybook": "^7.6.17",
111
+ "tailwindcss": "^3.3.5",
112
+ "vite": "^4.5.0"
113
+ }
114
+ }