docthub-core-components 1.0.14 → 1.0.16

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 CHANGED
@@ -4,10 +4,28 @@ A modern, reusable React component library built with TypeScript and Vite. Inclu
4
4
 
5
5
  ## ✨ Features
6
6
 
7
- - Built with React 18, TypeScript, and Vite
8
- - Tree-shakable and lightweight
9
- - Includes buttons, inputs, dialogs, pickers, and more
10
- - Designed for easy theming and customization
7
+ - **🚀 Modern Stack**: Built with React 18, TypeScript, and Vite
8
+ - **📦 Tree-shakable**: Lightweight and optimized bundle
9
+ - **🎨 Comprehensive**: 30+ components including buttons, inputs, dialogs, pickers, and more
10
+ - **♿ Accessible**: WCAG compliant with proper ARIA attributes
11
+ - **🎯 Customizable**: Easy theming with CSS variables and Tailwind CSS
12
+ - **📚 Well-documented**: Comprehensive API documentation and Storybook examples
13
+ - **🧪 Tested**: Full test suite using Vitest and Testing Library
14
+ - **📊 Optimized**: Bundle size analysis and performance monitoring
15
+
16
+ ## 📖 Documentation
17
+
18
+ For comprehensive API documentation, examples, and usage instructions, see:
19
+
20
+ **[📚 API Documentation](./API_DOCUMENTATION.md)**
21
+
22
+ The API documentation covers:
23
+ - All 30+ components with detailed props and examples
24
+ - TypeScript interfaces and type definitions
25
+ - Best practices and patterns
26
+ - Accessibility guidelines
27
+ - Theming and customization
28
+ - Migration guides
11
29
 
12
30
  ## 📦 Installation
13
31
 
@@ -17,53 +35,199 @@ npm install docthub-core-components
17
35
  yarn add docthub-core-components
18
36
  ```
19
37
 
20
- ## 🚀 Usage
38
+ ### Peer Dependencies
39
+
40
+ ```bash
41
+ npm install react@^18.0.0 react-dom@^18.0.0
42
+ ```
43
+
44
+ ## 🚀 Quick Start
21
45
 
22
46
  ```tsx
23
- import { Button, PasswordInput, SelectField } from 'docthub-core-components';
47
+ import {
48
+ DoctButton,
49
+ DoctTypography,
50
+ LabeledInput,
51
+ SearchInput,
52
+ DatePickerField
53
+ } from 'docthub-core-components';
24
54
 
25
55
  function App() {
26
56
  return (
27
- <div>
28
- <Button variant="primary">Click me</Button>
29
- <PasswordInput label="Password" onChange={val => console.log(val)} />
30
- <SelectField label="Account Type" options={[{ value: 'user', label: 'User' }]} />
57
+ <div className="p-6 space-y-4">
58
+ <DoctTypography variant="h1" weight="bold">
59
+ Welcome to DocthHub Components
60
+ </DoctTypography>
61
+
62
+ <SearchInput
63
+ placeholder="Search anything..."
64
+ size="large"
65
+ />
66
+
67
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
68
+ <LabeledInput
69
+ label="Email"
70
+ type="email"
71
+ placeholder="Enter your email"
72
+ required
73
+ />
74
+
75
+ <DatePickerField
76
+ label="Date of Birth"
77
+ placeholder="Select date"
78
+ />
79
+ </div>
80
+
81
+ <div className="flex gap-2">
82
+ <DoctButton variant="outline">
83
+ Cancel
84
+ </DoctButton>
85
+ <DoctButton variant="primary" size="large">
86
+ Get Started
87
+ </DoctButton>
88
+ </div>
31
89
  </div>
32
90
  );
33
91
  }
34
92
  ```
35
93
 
36
- ## 🧩 Components
94
+ ## 🧩 Component Categories
95
+
96
+ ### Core Components
97
+ - **DoctButton** - Flexible button with multiple variants and icon support
98
+ - **DoctTypography** - Comprehensive typography system
99
+ - **DoctAnimationLoader** - Loading states
100
+
101
+ ### Input Components
102
+ - **LabeledInput** - Input with integrated label and validation
103
+ - **PasswordInput** - Password field with show/hide toggle
104
+ - **OtpInput** - One-time password input
105
+ - **TextareaField** - Multi-line text input
106
+ - **CurrencyInput** - Currency-specific input formatting
107
+
108
+ ### Picker Components
109
+ - **DatePickerField** - Calendar date picker
110
+ - **SelectField** - Dropdown with search functionality
111
+
112
+ ### Search Components
113
+ - **SearchInput** - Search field with icon
114
+ - **AutoComplete** - Autocomplete with suggestions
115
+ - **DoctAutocomplete** - Enhanced autocomplete
116
+
117
+ ### Display Components
118
+ - **DoctChip** - Tags and labels
119
+ - **ExpandableCard** - Collapsible content cards
120
+
121
+ ### Composed Components
122
+ - **SearchFilterSection** - Complete search and filter UI
123
+ - **UserRegistrationSection** - Full registration form
124
+ - **AddressFormSection** - Address input form
125
+ - **ContactFormSection** - Contact information form
126
+
127
+ ### Base UI Components
128
+ - **Alert, Avatar, Checkbox, Dialog, Drawer, DropdownMenu**
129
+ - **Popover, RadioGroup, Tabs, Toast, Tooltip**
130
+ - And more foundational components
131
+
132
+ ## 🎨 Theming
133
+
134
+ Components support theming via CSS custom properties:
135
+
136
+ ```css
137
+ :root {
138
+ --customBlue: #3b82f6;
139
+ --foreground: #000000;
140
+ --background: #ffffff;
141
+ --muted-foreground: #6b7280;
142
+ --destructive: #ef4444;
143
+ /* ... customize as needed */
144
+ }
145
+ ```
37
146
 
38
- - `Button`
39
- - `PasswordInput`
40
- - `SelectField`
41
- - `LabeledInput`
42
- - `DatePickerField`
43
- - `OtpInput`
44
- - `Toast`
45
- - ...and more!
147
+ ## 🛠️ Development
46
148
 
47
- ## 🔗 Peer Dependencies
149
+ ### Setup
150
+ ```bash
151
+ git clone <repository>
152
+ cd docthub-core-components
153
+ npm install
154
+ ```
48
155
 
49
- - `react` (v18+)
50
- - `react-dom` (v18+)
156
+ ### Available Scripts
157
+ ```bash
158
+ npm run dev # Start development server
159
+ npm run build # Build for production
160
+ npm run storybook # Start Storybook
161
+ npm test # Run test suite
162
+ npm run analyze # Bundle size analysis
163
+ ```
51
164
 
52
- ## 🛠️ Development
165
+ ## 📚 Storybook
53
166
 
54
- Clone the repo and run:
167
+ Explore all components interactively:
55
168
 
56
169
  ```bash
57
- npm install
58
- npm run dev
170
+ npm run storybook
171
+ ```
172
+
173
+ View component examples, props, and interactive demos at `http://localhost:6006`
174
+
175
+ ## 🧪 Testing
176
+
177
+ Comprehensive test suite with Vitest and Testing Library:
178
+
179
+ ```bash
180
+ npm test # Run all tests
181
+ npm test -- --watch # Watch mode
182
+ npm test -- --coverage # Coverage report
59
183
  ```
60
184
 
61
- To run tests:
185
+ **Note**: Some Radix UI Select component tests are skipped due to [JSDOM limitations](https://github.com/radix-ui/primitives/issues/1822).
186
+
187
+ ## 📊 Bundle Analysis
188
+
189
+ Analyze bundle size and dependencies (local development only):
62
190
 
63
191
  ```bash
64
- npm test
192
+ npm run analyze
65
193
  ```
66
194
 
195
+ Opens `dist/bundle-visualizer.html` with detailed treemap visualization.
196
+
197
+ **Note**: Bundle analysis uses a separate configuration to prevent deployment issues in cloud environments like Vercel. Use `npm run build` for production builds.
198
+
199
+ ## 🔗 Peer Dependencies
200
+
201
+ - `react` ^18.0.0
202
+ - `react-dom` ^18.0.0
203
+
204
+ ## 📝 TypeScript
205
+
206
+ Fully typed with TypeScript. Export interfaces for custom implementations:
207
+
208
+ ```tsx
209
+ import type {
210
+ DoctButtonProps,
211
+ LabeledInputProps,
212
+ SearchInputProps
213
+ } from 'docthub-core-components';
214
+ ```
215
+
216
+ ## 🤝 Contributing
217
+
218
+ 1. Fork the repository
219
+ 2. Create a feature branch
220
+ 3. Follow the existing code style
221
+ 4. Add tests for new components
222
+ 5. Update documentation
223
+ 6. Submit a pull request
224
+
225
+ See [API Documentation](./API_DOCUMENTATION.md#contributing) for detailed guidelines.
226
+
67
227
  ## 📄 License
68
228
 
69
- MIT
229
+ MIT License - see [LICENSE](./LICENSE) file for details.
230
+
231
+ ---
232
+
233
+ **[📚 View Full API Documentation](./API_DOCUMENTATION.md)**