pure-react-ui 1.5.4 → 1.5.6
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 +558 -505
- package/lib/components/Form/Form.css +1065 -1048
- package/lib/components/Form/FormItem.js +8 -8
- package/lib/components/Form/FormItem.js.map +1 -1
- package/lib/components/Form/Select.d.ts +17 -2
- package/lib/components/Form/Select.d.ts.map +1 -1
- package/lib/components/Form/Select.js +135 -8
- package/lib/components/Form/Select.js.map +1 -1
- package/lib/components/Form/index.d.ts +0 -2
- package/lib/components/Form/index.d.ts.map +1 -1
- package/lib/components/Form/index.js +0 -1
- package/lib/components/Form/index.js.map +1 -1
- package/lib/components/Modal/Modal.css +509 -509
- package/lib/components/Text/Text.css +1 -0
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -1,505 +1,558 @@
|
|
|
1
|
-
# Pure React UI
|
|
2
|
-
|
|
3
|
-
A pure React UI component library built with TypeScript. No external dependencies required (except React and ReactDOM as peer dependencies).
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install pure-react-ui
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
Card
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
- `
|
|
58
|
-
- `
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
- `
|
|
85
|
-
- `
|
|
86
|
-
- `
|
|
87
|
-
- `
|
|
88
|
-
- `
|
|
89
|
-
- `
|
|
90
|
-
- `
|
|
91
|
-
- `
|
|
92
|
-
- `
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
**
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
**
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
**
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
**
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
**
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
**
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
**
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
**
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
**
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
**
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
**
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
**
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
<Space size=
|
|
177
|
-
<
|
|
178
|
-
<
|
|
179
|
-
</
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
<Flex direction="
|
|
203
|
-
<
|
|
204
|
-
<
|
|
205
|
-
</
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
- `
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
- `
|
|
245
|
-
- `
|
|
246
|
-
- `
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
- `
|
|
296
|
-
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
- `
|
|
322
|
-
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
- `
|
|
392
|
-
- `
|
|
393
|
-
- `
|
|
394
|
-
- `
|
|
395
|
-
- `
|
|
396
|
-
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
-
|
|
467
|
-
-
|
|
468
|
-
-
|
|
469
|
-
-
|
|
470
|
-
-
|
|
471
|
-
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
1
|
+
# Pure React UI
|
|
2
|
+
|
|
3
|
+
A pure React UI component library built with TypeScript. No external dependencies required (except React and ReactDOM as peer dependencies).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install pure-react-ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Note:** The `Select` component requires `react-select` as a peer dependency. If you're using the Select component, make sure to install it:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install react-select
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Components
|
|
18
|
+
|
|
19
|
+
### Button
|
|
20
|
+
|
|
21
|
+
A versatile button component with multiple variants and sizes.
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { Button } from 'pure-react-ui';
|
|
25
|
+
|
|
26
|
+
<Button variant="primary" size="medium" onClick={handleClick}>
|
|
27
|
+
Click Me
|
|
28
|
+
</Button>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Props:**
|
|
32
|
+
- `variant`: 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' (default: 'primary')
|
|
33
|
+
- `size`: 'small' | 'medium' | 'large' (default: 'medium')
|
|
34
|
+
- `fullWidth`: boolean (default: false)
|
|
35
|
+
- `loading`: boolean (default: false)
|
|
36
|
+
- All standard button HTML attributes
|
|
37
|
+
|
|
38
|
+
### Card
|
|
39
|
+
|
|
40
|
+
A flexible card component for displaying content.
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import { Card } from 'pure-react-ui';
|
|
44
|
+
|
|
45
|
+
<Card
|
|
46
|
+
title="Card Title"
|
|
47
|
+
subtitle="Card Subtitle"
|
|
48
|
+
image="/path/to/image.jpg"
|
|
49
|
+
hoverable
|
|
50
|
+
shadow="medium"
|
|
51
|
+
>
|
|
52
|
+
Card content goes here
|
|
53
|
+
</Card>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Props:**
|
|
57
|
+
- `title`: string (optional)
|
|
58
|
+
- `subtitle`: string (optional)
|
|
59
|
+
- `image`: string (optional)
|
|
60
|
+
- `imageAlt`: string (optional)
|
|
61
|
+
- `footer`: React.ReactNode (optional)
|
|
62
|
+
- `hoverable`: boolean (default: false)
|
|
63
|
+
- `shadow`: 'none' | 'small' | 'medium' | 'large' (default: 'medium')
|
|
64
|
+
- `onClick`: () => void (optional)
|
|
65
|
+
|
|
66
|
+
### Modal
|
|
67
|
+
|
|
68
|
+
A modal dialog component with overlay and keyboard support.
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
import { Modal } from 'pure-react-ui';
|
|
72
|
+
|
|
73
|
+
<Modal
|
|
74
|
+
isOpen={isOpen}
|
|
75
|
+
onClose={() => setIsOpen(false)}
|
|
76
|
+
title="Modal Title"
|
|
77
|
+
size="medium"
|
|
78
|
+
>
|
|
79
|
+
Modal content goes here
|
|
80
|
+
</Modal>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Props:**
|
|
84
|
+
- `isOpen`: boolean (required)
|
|
85
|
+
- `onClose`: () => void (required)
|
|
86
|
+
- `title`: string | React.ReactNode (optional) - Modal title or custom header content
|
|
87
|
+
- `size`: 'small' | 'medium' | 'large' | 'fullscreen' (default: 'medium')
|
|
88
|
+
- `position`: 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' (default: 'center')
|
|
89
|
+
- `variant`: 'default' | 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'gradient-primary' | 'gradient-success' | 'gradient-danger' | 'gradient-info' (default: 'default')
|
|
90
|
+
- `closeOnOverlayClick`: boolean (default: true)
|
|
91
|
+
- `closeOnEscape`: boolean (default: true)
|
|
92
|
+
- `showCloseButton`: boolean (default: true)
|
|
93
|
+
- `scrollable`: boolean (default: true) - Enable scrolling for modal body
|
|
94
|
+
- `topMargin`: number | string (optional) - Custom top margin for modal
|
|
95
|
+
- `className`: string (optional) - Additional CSS classes
|
|
96
|
+
- `overlayClassName`: string (optional) - Additional CSS classes for overlay
|
|
97
|
+
- `headerClassName`: string (optional) - Additional CSS classes for header
|
|
98
|
+
- `bodyClassName`: string (optional) - Additional CSS classes for body
|
|
99
|
+
|
|
100
|
+
### Icon
|
|
101
|
+
|
|
102
|
+
A comprehensive icon component library with 100+ SVG icons.
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
import { Icon } from 'pure-react-ui';
|
|
106
|
+
|
|
107
|
+
<Icon name="Home" size={24} color="#007bff" />
|
|
108
|
+
<Icon name="Search" size={32} onClick={handleClick} />
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Props:**
|
|
112
|
+
- `name`: IconName (required) - Name of the icon to display
|
|
113
|
+
- `size`: number | string (default: 24) - Size of the icon
|
|
114
|
+
- `color`: string (default: 'currentColor') - Color of the icon
|
|
115
|
+
- `className`: string (optional) - Additional CSS classes
|
|
116
|
+
- `onClick`: () => void (optional) - Click handler (makes icon clickable)
|
|
117
|
+
|
|
118
|
+
**Available Icons:**
|
|
119
|
+
|
|
120
|
+
**Arrows & Navigation:**
|
|
121
|
+
ArrowLeft, ArrowRight, ArrowUp, ArrowDown, ArrowUpRight, ArrowDownRight, ChevronLeft, ChevronRight, ChevronUp, ChevronDown, DoubleChevronLeft, DoubleChevronRight, Home, Menu, Close, Search, Filter
|
|
122
|
+
|
|
123
|
+
**Actions:**
|
|
124
|
+
Plus, Minus, Check, X, Edit, Trash, Save, Download, Upload, Copy, Share
|
|
125
|
+
|
|
126
|
+
**Media:**
|
|
127
|
+
Play, Pause, Stop, VolumeUp, VolumeDown, VolumeOff, Image, Video, Camera
|
|
128
|
+
|
|
129
|
+
**Communication:**
|
|
130
|
+
Mail, Message, Phone, Bell, Notification
|
|
131
|
+
|
|
132
|
+
**Files:**
|
|
133
|
+
File, Folder, FolderOpen, FileText, FilePdf
|
|
134
|
+
|
|
135
|
+
**User:**
|
|
136
|
+
User, Users, UserPlus, UserMinus, Settings, Logout
|
|
137
|
+
|
|
138
|
+
**Status:**
|
|
139
|
+
CheckCircle, XCircle, AlertCircle, Info, Warning, Star, Heart, Bookmark
|
|
140
|
+
|
|
141
|
+
**Social:**
|
|
142
|
+
Facebook, Twitter, Instagram, Linkedin, Github, Youtube
|
|
143
|
+
|
|
144
|
+
**Technology:**
|
|
145
|
+
Wifi, Bluetooth, Battery, Zap, Lock, Unlock, Shield
|
|
146
|
+
|
|
147
|
+
**Shopping:**
|
|
148
|
+
ShoppingCart, ShoppingBag, CreditCard, Gift
|
|
149
|
+
|
|
150
|
+
**Time:**
|
|
151
|
+
Clock, Calendar, Timer
|
|
152
|
+
|
|
153
|
+
**Location:**
|
|
154
|
+
MapPin, Globe, Navigation
|
|
155
|
+
|
|
156
|
+
**Weather:**
|
|
157
|
+
Sun, Moon, Cloud
|
|
158
|
+
|
|
159
|
+
**Utility:**
|
|
160
|
+
Eye, EyeOff, Refresh, MoreVertical, MoreHorizontal, Grid, List
|
|
161
|
+
|
|
162
|
+
You can also import individual icons directly:
|
|
163
|
+
```tsx
|
|
164
|
+
import { Home, Search, User } from 'pure-react-ui';
|
|
165
|
+
|
|
166
|
+
<Home size={24} color="#007bff" />
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Space
|
|
170
|
+
|
|
171
|
+
A layout component for adding consistent spacing between elements.
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
import { Space } from 'pure-react-ui';
|
|
175
|
+
|
|
176
|
+
<Space size="medium" direction="horizontal">
|
|
177
|
+
<Button>Button 1</Button>
|
|
178
|
+
<Button>Button 2</Button>
|
|
179
|
+
<Button>Button 3</Button>
|
|
180
|
+
</Space>
|
|
181
|
+
|
|
182
|
+
<Space size={20} direction="vertical" align="start">
|
|
183
|
+
<Card>Card 1</Card>
|
|
184
|
+
<Card>Card 2</Card>
|
|
185
|
+
</Space>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Props:**
|
|
189
|
+
- `size`: 'small' | 'medium' | 'large' | number (default: 'medium') - Spacing size between items
|
|
190
|
+
- `direction`: 'horizontal' | 'vertical' (default: 'horizontal') - Direction of spacing
|
|
191
|
+
- `align`: 'start' | 'end' | 'center' | 'baseline' | 'stretch' (default: 'center') - Alignment of items
|
|
192
|
+
- `wrap`: boolean (default: false) - Whether items should wrap to next line
|
|
193
|
+
- `className`: string (optional) - Additional CSS classes
|
|
194
|
+
|
|
195
|
+
### Flex
|
|
196
|
+
|
|
197
|
+
A flexible container component based on CSS Flexbox.
|
|
198
|
+
|
|
199
|
+
```tsx
|
|
200
|
+
import { Flex } from 'pure-react-ui';
|
|
201
|
+
|
|
202
|
+
<Flex direction="row" justify="between" align="center" gap="medium">
|
|
203
|
+
<Button>Left</Button>
|
|
204
|
+
<Button>Center</Button>
|
|
205
|
+
<Button>Right</Button>
|
|
206
|
+
</Flex>
|
|
207
|
+
|
|
208
|
+
<Flex direction="column" justify="start" align="stretch" gap={16}>
|
|
209
|
+
<Card>Card 1</Card>
|
|
210
|
+
<Card>Card 2</Card>
|
|
211
|
+
</Flex>
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**Props:**
|
|
215
|
+
- `direction`: 'row' | 'column' | 'row-reverse' | 'column-reverse' (default: 'row') - Flex direction
|
|
216
|
+
- `justify`: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly' (default: 'start') - Justify content
|
|
217
|
+
- `align`: 'start' | 'end' | 'center' | 'baseline' | 'stretch' (default: 'start') - Align items
|
|
218
|
+
- `wrap`: boolean | 'wrap' | 'nowrap' | 'wrap-reverse' (default: false) - Flex wrap behavior
|
|
219
|
+
- `gap`: 'none' | 'small' | 'medium' | 'large' | number (default: 'none') - Gap between items
|
|
220
|
+
- `className`: string (optional) - Additional CSS classes
|
|
221
|
+
- `style`: React.CSSProperties (optional) - Additional inline styles
|
|
222
|
+
|
|
223
|
+
### Text
|
|
224
|
+
|
|
225
|
+
A typography component for consistent text styling with various options.
|
|
226
|
+
|
|
227
|
+
```tsx
|
|
228
|
+
import { Text } from 'pure-react-ui';
|
|
229
|
+
|
|
230
|
+
<Text as="h1" size="2xl" weight="bold" color="primary">
|
|
231
|
+
Heading Text
|
|
232
|
+
</Text>
|
|
233
|
+
|
|
234
|
+
<Text size="lg" color="muted" align="center">
|
|
235
|
+
Centered paragraph text
|
|
236
|
+
</Text>
|
|
237
|
+
|
|
238
|
+
<Text as="span" size="sm" decoration="underline" transform="uppercase">
|
|
239
|
+
Styled Text
|
|
240
|
+
</Text>
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**Props:**
|
|
244
|
+
- `as`: 'p' | 'span' | 'div' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'label' | 'small' | 'strong' | 'em' | 'code' | 'pre' (default: 'p') - HTML element to render
|
|
245
|
+
- `size`: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' (default: 'md') - Font size
|
|
246
|
+
- `weight`: 'light' | 'normal' | 'medium' | 'semibold' | 'bold' (default: 'normal') - Font weight
|
|
247
|
+
- `color`: 'default' | 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'muted' (default: 'default') - Text color
|
|
248
|
+
- `align`: 'left' | 'center' | 'right' | 'justify' (default: 'left') - Text alignment
|
|
249
|
+
- `transform`: 'none' | 'uppercase' | 'lowercase' | 'capitalize' (default: 'none') - Text transform
|
|
250
|
+
- `decoration`: 'none' | 'underline' | 'line-through' | 'overline' (default: 'none') - Text decoration
|
|
251
|
+
- `truncate`: boolean (default: false) - Truncate text with ellipsis
|
|
252
|
+
- `className`: string (optional) - Additional CSS classes
|
|
253
|
+
|
|
254
|
+
### Form Components
|
|
255
|
+
|
|
256
|
+
A comprehensive form component system with all form elements.
|
|
257
|
+
|
|
258
|
+
#### Form
|
|
259
|
+
|
|
260
|
+
The main form container component.
|
|
261
|
+
|
|
262
|
+
```tsx
|
|
263
|
+
import { Form } from 'pure-react-ui';
|
|
264
|
+
|
|
265
|
+
<Form layout="vertical" onSubmit={handleSubmit}>
|
|
266
|
+
{/* Form fields */}
|
|
267
|
+
</Form>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
**Props:**
|
|
271
|
+
- `layout`: 'vertical' | 'horizontal' | 'inline' (default: 'vertical')
|
|
272
|
+
- `size`: 'small' | 'medium' | 'large' (default: 'medium')
|
|
273
|
+
- `onSubmit`: (e: React.FormEvent) => void (optional)
|
|
274
|
+
- All standard form HTML attributes
|
|
275
|
+
|
|
276
|
+
#### Input
|
|
277
|
+
|
|
278
|
+
Text input field with validation and icons.
|
|
279
|
+
|
|
280
|
+
```tsx
|
|
281
|
+
import { Input } from 'pure-react-ui';
|
|
282
|
+
|
|
283
|
+
<Input
|
|
284
|
+
label="Email"
|
|
285
|
+
type="email"
|
|
286
|
+
placeholder="Enter email"
|
|
287
|
+
error={errors.email}
|
|
288
|
+
helpText="We'll never share your email"
|
|
289
|
+
leftIcon={<Icon name="Mail" />}
|
|
290
|
+
fullWidth
|
|
291
|
+
/>
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
**Props:**
|
|
295
|
+
- `label`: string (optional)
|
|
296
|
+
- `error`: string (optional) - Error message
|
|
297
|
+
- `helpText`: string (optional) - Help text
|
|
298
|
+
- `leftIcon`: React.ReactNode (optional)
|
|
299
|
+
- `rightIcon`: React.ReactNode (optional)
|
|
300
|
+
- `fullWidth`: boolean (default: false)
|
|
301
|
+
- `size`: 'small' | 'medium' | 'large' (default: 'medium')
|
|
302
|
+
- All standard input HTML attributes
|
|
303
|
+
|
|
304
|
+
#### Textarea
|
|
305
|
+
|
|
306
|
+
Multi-line text input.
|
|
307
|
+
|
|
308
|
+
```tsx
|
|
309
|
+
import { Textarea } from 'pure-react-ui';
|
|
310
|
+
|
|
311
|
+
<Textarea
|
|
312
|
+
label="Message"
|
|
313
|
+
placeholder="Enter your message"
|
|
314
|
+
rows={4}
|
|
315
|
+
resize="vertical"
|
|
316
|
+
fullWidth
|
|
317
|
+
/>
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
**Props:**
|
|
321
|
+
- `label`: string (optional)
|
|
322
|
+
- `error`: string (optional)
|
|
323
|
+
- `helpText`: string (optional)
|
|
324
|
+
- `fullWidth`: boolean (default: false)
|
|
325
|
+
- `size`: 'small' | 'medium' | 'large' (default: 'medium')
|
|
326
|
+
- `rows`: number (default: 4)
|
|
327
|
+
- `resize`: 'none' | 'both' | 'horizontal' | 'vertical' (default: 'vertical')
|
|
328
|
+
- All standard textarea HTML attributes
|
|
329
|
+
|
|
330
|
+
#### Select
|
|
331
|
+
|
|
332
|
+
Advanced dropdown select component powered by react-select with search, multi-select, and more features.
|
|
333
|
+
|
|
334
|
+
**Note:** This component requires `react-select` to be installed as a peer dependency:
|
|
335
|
+
```bash
|
|
336
|
+
npm install react-select
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
```tsx
|
|
340
|
+
import { Select } from 'pure-react-ui';
|
|
341
|
+
|
|
342
|
+
// Basic Select
|
|
343
|
+
<Select
|
|
344
|
+
label="Country"
|
|
345
|
+
options={[
|
|
346
|
+
{ value: 'us', label: 'United States' },
|
|
347
|
+
{ value: 'uk', label: 'United Kingdom' }
|
|
348
|
+
]}
|
|
349
|
+
placeholder="Choose a country"
|
|
350
|
+
fullWidth
|
|
351
|
+
/>
|
|
352
|
+
|
|
353
|
+
// Searchable Select
|
|
354
|
+
<Select
|
|
355
|
+
label="Search Country"
|
|
356
|
+
options={countries}
|
|
357
|
+
placeholder="Search and select"
|
|
358
|
+
isSearchable
|
|
359
|
+
isClearable
|
|
360
|
+
fullWidth
|
|
361
|
+
/>
|
|
362
|
+
|
|
363
|
+
// Multi Select
|
|
364
|
+
<Select
|
|
365
|
+
label="Select Frameworks"
|
|
366
|
+
options={frameworks}
|
|
367
|
+
placeholder="Select multiple"
|
|
368
|
+
isMulti
|
|
369
|
+
isSearchable
|
|
370
|
+
fullWidth
|
|
371
|
+
/>
|
|
372
|
+
|
|
373
|
+
// Select with Icons
|
|
374
|
+
<Select
|
|
375
|
+
label="Framework"
|
|
376
|
+
options={[
|
|
377
|
+
{ value: 'react', label: 'React', icon: <Icon name="Zap" /> },
|
|
378
|
+
{ value: 'vue', label: 'Vue.js', icon: <Icon name="Zap" /> }
|
|
379
|
+
]}
|
|
380
|
+
placeholder="Choose framework"
|
|
381
|
+
fullWidth
|
|
382
|
+
/>
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
**Props:**
|
|
386
|
+
- `label`: string (optional)
|
|
387
|
+
- `error`: string (optional)
|
|
388
|
+
- `helpText`: string (optional)
|
|
389
|
+
- `options`: SelectOption[] (required) - Array of options with `value`, `label`, optional `disabled`, and optional `icon`
|
|
390
|
+
- `placeholder`: string (optional, default: 'Select...')
|
|
391
|
+
- `value`: string | number | (string | number)[] (optional) - Controlled value
|
|
392
|
+
- `defaultValue`: string | number | (string | number)[] (optional) - Uncontrolled default value
|
|
393
|
+
- `multiple` or `isMulti`: boolean (default: false) - Enable multi-select
|
|
394
|
+
- `searchable` or `isSearchable`: boolean (default: false) - Enable search functionality
|
|
395
|
+
- `allowClear` or `isClearable`: boolean (default: false) - Show clear button
|
|
396
|
+
- `disabled`: boolean (default: false)
|
|
397
|
+
- `fullWidth`: boolean (default: false)
|
|
398
|
+
- `size`: 'small' | 'medium' | 'large' (default: 'medium')
|
|
399
|
+
- `onChange`: (value: string | number | (string | number)[]) => void (optional)
|
|
400
|
+
- `onSearch`: (searchText: string) => void (optional) - Callback when search text changes
|
|
401
|
+
- `name`: string (optional) - Form field name
|
|
402
|
+
- `id`: string (optional) - Custom ID for the select
|
|
403
|
+
- `className`: string (optional)
|
|
404
|
+
|
|
405
|
+
#### Checkbox
|
|
406
|
+
|
|
407
|
+
Checkbox input with custom styling.
|
|
408
|
+
|
|
409
|
+
```tsx
|
|
410
|
+
import { Checkbox } from 'pure-react-ui';
|
|
411
|
+
|
|
412
|
+
<Checkbox
|
|
413
|
+
label="I agree to terms"
|
|
414
|
+
checked={checked}
|
|
415
|
+
onChange={(e) => setChecked(e.target.checked)}
|
|
416
|
+
/>
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
**Props:**
|
|
420
|
+
- `label`: string (optional)
|
|
421
|
+
- `error`: string (optional)
|
|
422
|
+
- `helpText`: string (optional)
|
|
423
|
+
- `fullWidth`: boolean (default: false)
|
|
424
|
+
- `size`: 'small' | 'medium' | 'large' (default: 'medium')
|
|
425
|
+
- All standard checkbox HTML attributes
|
|
426
|
+
|
|
427
|
+
#### Radio
|
|
428
|
+
|
|
429
|
+
Radio button input.
|
|
430
|
+
|
|
431
|
+
```tsx
|
|
432
|
+
import { Radio } from 'pure-react-ui';
|
|
433
|
+
|
|
434
|
+
<Radio
|
|
435
|
+
label="Option 1"
|
|
436
|
+
name="option"
|
|
437
|
+
value="1"
|
|
438
|
+
checked={selected === '1'}
|
|
439
|
+
onChange={(e) => setSelected(e.target.value)}
|
|
440
|
+
/>
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
**Props:**
|
|
444
|
+
- `label`: string (optional)
|
|
445
|
+
- `error`: string (optional)
|
|
446
|
+
- `helpText`: string (optional)
|
|
447
|
+
- `fullWidth`: boolean (default: false)
|
|
448
|
+
- `size`: 'small' | 'medium' | 'large' (default: 'medium')
|
|
449
|
+
- All standard radio HTML attributes
|
|
450
|
+
|
|
451
|
+
#### Switch
|
|
452
|
+
|
|
453
|
+
Toggle switch component.
|
|
454
|
+
|
|
455
|
+
```tsx
|
|
456
|
+
import { Switch } from 'pure-react-ui';
|
|
457
|
+
|
|
458
|
+
<Switch
|
|
459
|
+
label="Enable notifications"
|
|
460
|
+
checked={enabled}
|
|
461
|
+
onChange={(e) => setEnabled(e.target.checked)}
|
|
462
|
+
/>
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
**Props:**
|
|
466
|
+
- `label`: string (optional)
|
|
467
|
+
- `error`: string (optional)
|
|
468
|
+
- `helpText`: string (optional)
|
|
469
|
+
- `fullWidth`: boolean (default: false)
|
|
470
|
+
- `size`: 'small' | 'medium' | 'large' (default: 'medium')
|
|
471
|
+
- All standard checkbox HTML attributes (used as switch)
|
|
472
|
+
|
|
473
|
+
#### FormGroup
|
|
474
|
+
|
|
475
|
+
Container for grouping form fields.
|
|
476
|
+
|
|
477
|
+
```tsx
|
|
478
|
+
import { FormGroup } from 'pure-react-ui';
|
|
479
|
+
|
|
480
|
+
<FormGroup label="Personal Information" required>
|
|
481
|
+
<Input label="Name" />
|
|
482
|
+
<Input label="Email" />
|
|
483
|
+
</FormGroup>
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
**Props:**
|
|
487
|
+
- `label`: string (optional)
|
|
488
|
+
- `error`: string (optional)
|
|
489
|
+
- `helpText`: string (optional)
|
|
490
|
+
- `required`: boolean (default: false)
|
|
491
|
+
- `className`: string (optional)
|
|
492
|
+
|
|
493
|
+
#### FormRow
|
|
494
|
+
|
|
495
|
+
Horizontal row for form fields.
|
|
496
|
+
|
|
497
|
+
```tsx
|
|
498
|
+
import { FormRow } from 'pure-react-ui';
|
|
499
|
+
|
|
500
|
+
<FormRow gap="medium">
|
|
501
|
+
<Input label="First Name" fullWidth />
|
|
502
|
+
<Input label="Last Name" fullWidth />
|
|
503
|
+
</FormRow>
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
**Props:**
|
|
507
|
+
- `gap`: 'small' | 'medium' | 'large' | number (default: 'medium')
|
|
508
|
+
- `className`: string (optional)
|
|
509
|
+
|
|
510
|
+
## Styling
|
|
511
|
+
|
|
512
|
+
All components include their own CSS files and use CSS classes with the `pure-` prefix. The CSS files are automatically imported with each component. You can also style them by targeting these classes:
|
|
513
|
+
|
|
514
|
+
- **Button**: `pure-button`, `pure-button--primary`, `pure-button--secondary`, etc.
|
|
515
|
+
- **Card**: `pure-card`, `pure-card--hoverable`, `pure-card--shadow-medium`, etc.
|
|
516
|
+
- **Modal**: `pure-modal`, `pure-modal__overlay`, `pure-modal__header`, etc.
|
|
517
|
+
- **Icon**: `pure-icon`, `pure-icon--clickable`, `pure-icon--small`, etc.
|
|
518
|
+
- **Space**: `pure-space`, `pure-space--horizontal`, `pure-space--vertical`, etc.
|
|
519
|
+
- **Flex**: `pure-flex`, `pure-flex--row`, `pure-flex--column`, etc.
|
|
520
|
+
- **Text**: `pure-text`, `pure-text--lg`, `pure-text--bold`, etc.
|
|
521
|
+
- **Form**: `pure-form`, `pure-form--vertical`, `pure-form--horizontal`, etc.
|
|
522
|
+
- **Input**: `pure-input`, `pure-input--error`, `pure-input--small`, etc.
|
|
523
|
+
- **Textarea**: `pure-textarea`, `pure-textarea--error`, etc.
|
|
524
|
+
- **Select**: `pure-select`, `pure-select--error`, etc.
|
|
525
|
+
- **Checkbox**: `pure-checkbox`, `pure-checkbox--error`, etc.
|
|
526
|
+
- **Radio**: `pure-radio`, `pure-radio--error`, etc.
|
|
527
|
+
- **Switch**: `pure-switch`, `pure-switch--error`, etc.
|
|
528
|
+
|
|
529
|
+
Each component has its own CSS file located in:
|
|
530
|
+
- `lib/components/Button/Button.css`
|
|
531
|
+
- `lib/components/Card/Card.css`
|
|
532
|
+
- `lib/components/Modal/Modal.css`
|
|
533
|
+
- `lib/components/Icon/Icon.css`
|
|
534
|
+
- `lib/components/Space/Space.css`
|
|
535
|
+
- `lib/components/Flex/Flex.css`
|
|
536
|
+
- `lib/components/Text/Text.css`
|
|
537
|
+
- `lib/components/Form/Form.css`
|
|
538
|
+
|
|
539
|
+
## Examples
|
|
540
|
+
|
|
541
|
+
A complete example application is available in the `example` directory. To run it:
|
|
542
|
+
|
|
543
|
+
```bash
|
|
544
|
+
# From the root directory, build the package first
|
|
545
|
+
npm run build
|
|
546
|
+
|
|
547
|
+
# Then navigate to example directory
|
|
548
|
+
cd example
|
|
549
|
+
npm install
|
|
550
|
+
npm run dev
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
Or check out `EXAMPLES.md` for code examples and usage patterns.
|
|
554
|
+
|
|
555
|
+
## License
|
|
556
|
+
|
|
557
|
+
MIT
|
|
558
|
+
|