pure-react-ui 1.2.0 → 1.3.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.
Files changed (2) hide show
  1. package/README.md +321 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,321 @@
1
+ # Advanced Professional Button Component
2
+
3
+ A modern, fully-featured React button component with TypeScript support, multiple variants, sizes, and advanced features like ripple effects, loading states, and elevation shadows.
4
+
5
+ ## Features
6
+
7
+ ✨ **Multiple Variants**: Solid, Outline, Ghost, and Gradient styles
8
+ 🎨 **6 Color Schemes**: Primary, Secondary, Success, Danger, Warning, Info
9
+ 📏 **5 Size Options**: Extra Small, Small, Medium, Large, Extra Large
10
+ 🎭 **Advanced Effects**: Ripple animation, Elevation shadows, Smooth transitions
11
+ ♿ **Accessible**: ARIA attributes, Keyboard navigation, Focus states
12
+ 🔄 **Loading States**: Built-in spinner with disabled interaction
13
+ 🎯 **Icon Support**: Left and right icon positioning
14
+ 📱 **Responsive**: Mobile-friendly with adaptive sizing
15
+ ⚡ **TypeScript**: Full type safety and IntelliSense support
16
+ 🎪 **2px Border Radius**: Sharp, professional appearance
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ # Copy these files to your project:
22
+ # - Button.tsx
23
+ # - Button.css
24
+ ```
25
+
26
+ ## Basic Usage
27
+
28
+ ```tsx
29
+ import { Button } from './components/Button';
30
+ import './components/Button.css';
31
+
32
+ function App() {
33
+ return (
34
+ <Button variant="primary" size="medium">
35
+ Click Me
36
+ </Button>
37
+ );
38
+ }
39
+ ```
40
+
41
+ ## Props
42
+
43
+ | Prop | Type | Default | Description |
44
+ |------|------|---------|-------------|
45
+ | `children` | `ReactNode` | - | Button content (required) |
46
+ | `variant` | `string` | `'primary'` | Button style variant |
47
+ | `size` | `'xs' \| 'small' \| 'medium' \| 'large' \| 'xl'` | `'medium'` | Button size |
48
+ | `loading` | `boolean` | `false` | Show loading spinner |
49
+ | `disabled` | `boolean` | `false` | Disable button interaction |
50
+ | `iconLeft` | `ReactNode` | - | Icon before text |
51
+ | `iconRight` | `ReactNode` | - | Icon after text |
52
+ | `fullWidth` | `boolean` | `false` | Make button full width |
53
+ | `rounded` | `boolean` | `false` | Use pill-shaped border radius |
54
+ | `elevation` | `'none' \| 'sm' \| 'md' \| 'lg'` | `'none'` | Shadow elevation level |
55
+ | `ripple` | `boolean` | `true` | Enable ripple effect on click |
56
+ | `className` | `string` | `''` | Additional CSS classes |
57
+ | `onClick` | `function` | - | Click handler |
58
+
59
+ Plus all standard HTML button attributes.
60
+
61
+ ## Variants
62
+
63
+ ### Solid Variants
64
+ ```tsx
65
+ <Button variant="primary">Primary</Button>
66
+ <Button variant="secondary">Secondary</Button>
67
+ <Button variant="success">Success</Button>
68
+ <Button variant="danger">Danger</Button>
69
+ <Button variant="warning">Warning</Button>
70
+ <Button variant="info">Info</Button>
71
+ ```
72
+
73
+ ### Outline Variants
74
+ ```tsx
75
+ <Button variant="outline-primary">Primary</Button>
76
+ <Button variant="outline-secondary">Secondary</Button>
77
+ <Button variant="outline-success">Success</Button>
78
+ <Button variant="outline-danger">Danger</Button>
79
+ <Button variant="outline-warning">Warning</Button>
80
+ <Button variant="outline-info">Info</Button>
81
+ ```
82
+
83
+ ### Ghost Variants
84
+ ```tsx
85
+ <Button variant="ghost-primary">Primary</Button>
86
+ <Button variant="ghost-secondary">Secondary</Button>
87
+ <Button variant="ghost-success">Success</Button>
88
+ <Button variant="ghost-danger">Danger</Button>
89
+ <Button variant="ghost-warning">Warning</Button>
90
+ <Button variant="ghost-info">Info</Button>
91
+ ```
92
+
93
+ ### Gradient Variants
94
+ ```tsx
95
+ <Button variant="gradient-primary">Gradient Primary</Button>
96
+ <Button variant="gradient-success">Gradient Success</Button>
97
+ <Button variant="gradient-danger">Gradient Danger</Button>
98
+ ```
99
+
100
+ ## Examples
101
+
102
+ ### With Icons
103
+
104
+ ```tsx
105
+ import { Download, Check, Search } from 'lucide-react';
106
+
107
+ <Button variant="primary" iconLeft={<Download />}>
108
+ Download
109
+ </Button>
110
+
111
+ <Button variant="success" iconRight={<Check />}>
112
+ Confirm
113
+ </Button>
114
+
115
+ <Button variant="outline-primary" iconLeft={<Search />}>
116
+ Search
117
+ </Button>
118
+ ```
119
+
120
+ ### Loading State
121
+
122
+ ```tsx
123
+ const [loading, setLoading] = useState(false);
124
+
125
+ const handleSubmit = async () => {
126
+ setLoading(true);
127
+ await someAsyncOperation();
128
+ setLoading(false);
129
+ };
130
+
131
+ <Button
132
+ variant="primary"
133
+ loading={loading}
134
+ onClick={handleSubmit}
135
+ >
136
+ {loading ? 'Processing...' : 'Submit'}
137
+ </Button>
138
+ ```
139
+
140
+ ### Different Sizes
141
+
142
+ ```tsx
143
+ <Button size="xs">Extra Small</Button>
144
+ <Button size="small">Small</Button>
145
+ <Button size="medium">Medium</Button>
146
+ <Button size="large">Large</Button>
147
+ <Button size="xl">Extra Large</Button>
148
+ ```
149
+
150
+ ### With Elevation
151
+
152
+ ```tsx
153
+ <Button variant="primary" elevation="sm">Small Shadow</Button>
154
+ <Button variant="primary" elevation="md">Medium Shadow</Button>
155
+ <Button variant="primary" elevation="lg">Large Shadow</Button>
156
+ ```
157
+
158
+ ### Rounded Buttons
159
+
160
+ ```tsx
161
+ <Button variant="primary" rounded>
162
+ Rounded Button
163
+ </Button>
164
+
165
+ <Button variant="outline-success" rounded elevation="md">
166
+ Rounded with Shadow
167
+ </Button>
168
+ ```
169
+
170
+ ### Full Width
171
+
172
+ ```tsx
173
+ <Button variant="gradient-primary" fullWidth size="large">
174
+ Full Width Button
175
+ </Button>
176
+ ```
177
+
178
+ ### Disabled State
179
+
180
+ ```tsx
181
+ <Button variant="primary" disabled>
182
+ Disabled Button
183
+ </Button>
184
+ ```
185
+
186
+ ### Advanced Combinations
187
+
188
+ ```tsx
189
+ <Button
190
+ variant="gradient-primary"
191
+ size="large"
192
+ rounded
193
+ elevation="lg"
194
+ iconLeft={<Download />}
195
+ >
196
+ Premium Action
197
+ </Button>
198
+
199
+ <Button
200
+ variant="outline-success"
201
+ size="large"
202
+ rounded
203
+ iconRight={<Check />}
204
+ onClick={handleConfirm}
205
+ >
206
+ Confirm Choice
207
+ </Button>
208
+ ```
209
+
210
+ ## Styling Customization
211
+
212
+ ### Override Styles
213
+
214
+ You can override default styles by targeting CSS classes:
215
+
216
+ ```css
217
+ /* Custom primary color */
218
+ .pru-btn-primary {
219
+ background-color: #your-color;
220
+ }
221
+
222
+ .pru-btn-primary:hover:not(:disabled) {
223
+ background-color: #your-hover-color;
224
+ }
225
+
226
+ /* Custom size */
227
+ .pru-btn-custom {
228
+ padding: 12px 24px;
229
+ font-size: 15px;
230
+ }
231
+
232
+ /* Custom border radius */
233
+ .pru-btn {
234
+ border-radius: 4px; /* Override default 2px */
235
+ }
236
+ ```
237
+
238
+ ### Additional Classes
239
+
240
+ ```tsx
241
+ <Button
242
+ variant="primary"
243
+ className="my-custom-class"
244
+ >
245
+ Custom Button
246
+ </Button>
247
+ ```
248
+
249
+ ## Accessibility
250
+
251
+ The button component includes:
252
+
253
+ - ✅ Proper ARIA attributes (`aria-disabled`, `aria-busy`)
254
+ - ✅ Keyboard navigation support
255
+ - ✅ Focus visible states
256
+ - ✅ Screen reader friendly loading states
257
+ - ✅ Disabled state handling
258
+ - ✅ Semantic HTML button element
259
+
260
+ ## Best Practices
261
+
262
+ 1. **Use appropriate variants** for different actions:
263
+ - `primary` for main actions
264
+ - `secondary` for secondary actions
265
+ - `success` for confirmations
266
+ - `danger` for destructive actions
267
+ - `outline` for less prominent actions
268
+ - `ghost` for tertiary actions
269
+
270
+ 2. **Choose the right size**:
271
+ - `xs` for compact UIs
272
+ - `small` for inline actions
273
+ - `medium` for most use cases
274
+ - `large` for CTAs
275
+ - `xl` for hero sections
276
+
277
+ 3. **Loading states**: Always show loading feedback for async operations
278
+
279
+ 4. **Icons**: Use meaningful icons that enhance understanding
280
+
281
+ 5. **Elevation**: Use shadows to create visual hierarchy
282
+
283
+ ## Browser Support
284
+
285
+ - ✅ Chrome (latest)
286
+ - ✅ Firefox (latest)
287
+ - ✅ Safari (latest)
288
+ - ✅ Edge (latest)
289
+ - ✅ Mobile browsers
290
+
291
+ ## Performance
292
+
293
+ - Lightweight CSS with efficient selectors
294
+ - Optimized animations using transform and opacity
295
+ - Minimal JavaScript overhead
296
+ - No external dependencies (except React)
297
+
298
+ ## TypeScript Support
299
+
300
+ Full TypeScript support with:
301
+ - Type-safe props
302
+ - IntelliSense autocomplete
303
+ - Type checking for variants and sizes
304
+ - Proper event typing
305
+
306
+ ## License
307
+
308
+ MIT License - Feel free to use in your projects!
309
+
310
+ ## Contributing
311
+
312
+ Contributions are welcome! Please feel free to submit issues or pull requests.
313
+
314
+ ## Credits
315
+
316
+ Created with ❤️ for professional React applications.
317
+
318
+ ---
319
+
320
+ **Version**: 1.0.0
321
+ **Last Updated**: 2024
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pure-react-ui",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Pure React UI components with zero external dependencies – only React and plain CSS",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",