@true-tech-team/react-components 0.0.9 → 0.0.10
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 +958 -959
- package/index.css +1 -1
- package/index.d.ts +15 -0
- package/index.js +1 -1
- package/index.mjs +10655 -8201
- package/lib/components/display/Accordion/index.d.ts +1 -1
- package/lib/components/display/Table/TableRow.d.ts +1 -1
- package/lib/components/display/Tabs/index.d.ts +1 -1
- package/lib/components/dnd/KanbanBoard/index.d.ts +1 -1
- package/lib/components/filters/index.d.ts +2 -2
- package/lib/components/inputs/Input/index.d.ts +1 -1
- package/lib/components/overlays/Alert/AlertProvider.d.ts +1 -1
- package/lib/components/overlays/Alert/index.d.ts +4 -4
- package/lib/components/overlays/Dialog/DialogProvider.d.ts +1 -1
- package/lib/components/overlays/Dialog/index.d.ts +3 -3
- package/lib/components/overlays/Toast/index.d.ts +2 -2
- package/lib/hooks/index.d.ts +16 -1
- package/lib/hooks/useClipboard/index.d.ts +2 -0
- package/lib/hooks/useClipboard/useClipboard.d.ts +67 -0
- package/lib/hooks/useIntersectionObserver/index.d.ts +2 -0
- package/lib/hooks/useIntersectionObserver/useIntersectionObserver.d.ts +103 -0
- package/lib/hooks/useInterval/index.d.ts +2 -0
- package/lib/hooks/useInterval/useInterval.d.ts +82 -0
- package/lib/hooks/useLocalStorage/index.d.ts +2 -0
- package/lib/hooks/useLocalStorage/useLocalStorage.d.ts +56 -0
- package/lib/hooks/useMediaQuery/index.d.ts +2 -0
- package/lib/hooks/useMediaQuery/useMediaQuery.d.ts +45 -0
- package/lib/hooks/usePopoverPosition/index.d.ts +1 -1
- package/lib/hooks/usePrevious/index.d.ts +1 -0
- package/lib/hooks/usePrevious/usePrevious.d.ts +35 -0
- package/lib/hooks/useTimeout/index.d.ts +2 -0
- package/lib/hooks/useTimeout/useTimeout.d.ts +70 -0
- package/lib/hooks/useUrlState/index.d.ts +2 -0
- package/lib/hooks/useUrlState/useUrlState.d.ts +83 -0
- package/lib/utils/index.d.ts +2 -2
- package/package.json +54 -55
package/README.md
CHANGED
|
@@ -1,959 +1,958 @@
|
|
|
1
|
-
# @true-tech-team/ui-components
|
|
2
|
-
|
|
3
|
-
A comprehensive React component library built with TypeScript, SCSS Modules, and featuring a robust theming system with dark/light mode support.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- 🎨 **Comprehensive Theming** - 37 color families with 10 shades each (370+ colors)
|
|
8
|
-
- 🌓 **Dark/Light Mode** - Built-in theme switching with CSS variables
|
|
9
|
-
- 📏 **4px Grid System** - Consistent spacing throughout
|
|
10
|
-
- 🎯 **Type-Safe** - Full TypeScript support with comprehensive types
|
|
11
|
-
- 🧩 **Component Library** - Reusable, customizable components
|
|
12
|
-
- 🎭 **Icon System** - SVG-based icons with easy customization
|
|
13
|
-
- 🛠️ **Utility Classes** - 500+ utility classes for rapid development
|
|
14
|
-
- 📦 **Tree-Shakeable** - Optimized bundle sizes
|
|
15
|
-
- ♿ **Accessible** - Built with accessibility in mind
|
|
16
|
-
|
|
17
|
-
## Installation
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm install @true-tech-team/ui-components
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Quick Start
|
|
24
|
-
|
|
25
|
-
### Wrap your app with GlobalProvider
|
|
26
|
-
|
|
27
|
-
```tsx
|
|
28
|
-
import { GlobalProvider } from '@true-tech-team/ui-components';
|
|
29
|
-
|
|
30
|
-
function App() {
|
|
31
|
-
return (
|
|
32
|
-
<GlobalProvider themeConfig={{ mode: 'light' }}>
|
|
33
|
-
<YourApp />
|
|
34
|
-
</GlobalProvider>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### Use components
|
|
40
|
-
|
|
41
|
-
```tsx
|
|
42
|
-
import { Button, Icon } from '@true-tech-team/ui-components';
|
|
43
|
-
|
|
44
|
-
function MyComponent() {
|
|
45
|
-
return (
|
|
46
|
-
<div>
|
|
47
|
-
<Button variant="primary" size="md">
|
|
48
|
-
Click me
|
|
49
|
-
</Button>
|
|
50
|
-
|
|
51
|
-
<Button variant="outline" startIcon={<Icon name="check" size={16} />}>
|
|
52
|
-
Save
|
|
53
|
-
</Button>
|
|
54
|
-
</div>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Components
|
|
60
|
-
|
|
61
|
-
### Buttons
|
|
62
|
-
|
|
63
|
-
#### Button
|
|
64
|
-
|
|
65
|
-
Versatile button component with multiple variants and sizes.
|
|
66
|
-
|
|
67
|
-
```tsx
|
|
68
|
-
<Button variant="primary" size="md" onClick={() => console.log('clicked')}>
|
|
69
|
-
Click me
|
|
70
|
-
</Button>
|
|
71
|
-
|
|
72
|
-
<Button variant="outline" startIcon={<Icon name="check" />}>
|
|
73
|
-
With Icon
|
|
74
|
-
</Button>
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
**Variants:** primary, secondary, outline, ghost
|
|
78
|
-
**Sizes:** sm, md, lg
|
|
79
|
-
|
|
80
|
-
#### IconButton
|
|
81
|
-
|
|
82
|
-
Button component optimized for icon-only display.
|
|
83
|
-
|
|
84
|
-
```tsx
|
|
85
|
-
<IconButton aria-label="Close" size="md">
|
|
86
|
-
<Icon name="close" />
|
|
87
|
-
</IconButton>
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### Display
|
|
91
|
-
|
|
92
|
-
#### Icon
|
|
93
|
-
|
|
94
|
-
SVG-based icon system with customizable size and color.
|
|
95
|
-
|
|
96
|
-
```tsx
|
|
97
|
-
<Icon name="check" size={24} color="var(--theme-primary)" />
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
**Available icons:** chevron-down, chevron-up, chevron-left, chevron-right, close, check, info, warning, error, eye, eye-off, user, users, building, dollar, chart-line, chart-bar, trending-down, and more
|
|
101
|
-
|
|
102
|
-
#### Avatar
|
|
103
|
-
|
|
104
|
-
User profile avatars with image, initials, and icon variants.
|
|
105
|
-
|
|
106
|
-
```tsx
|
|
107
|
-
<Avatar src="/path/to/image.jpg" alt="User name" size="md" />
|
|
108
|
-
<Avatar initials="JD" size="lg" />
|
|
109
|
-
<Avatar icon={<Icon name="user" />} variant="secondary" />
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
**Sizes:** xs, sm, md, lg, xl
|
|
113
|
-
**Variants:** primary, secondary, tertiary
|
|
114
|
-
|
|
115
|
-
#### Badge
|
|
116
|
-
|
|
117
|
-
Notification badges with count display.
|
|
118
|
-
|
|
119
|
-
```tsx
|
|
120
|
-
<Badge count={5} variant="primary" />
|
|
121
|
-
<Badge count={99} max={99} variant="error" />
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
#### Chip
|
|
125
|
-
|
|
126
|
-
Interactive chips for tags and selections.
|
|
127
|
-
|
|
128
|
-
```tsx
|
|
129
|
-
<Chip label="React" onDelete={() => {}} />
|
|
130
|
-
<Chip label="TypeScript" variant="outlined" />
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
#### Pill
|
|
134
|
-
|
|
135
|
-
Status and category pills.
|
|
136
|
-
|
|
137
|
-
```tsx
|
|
138
|
-
<Pill label="Active" variant="success" />
|
|
139
|
-
<Pill label="Pending" variant="warning" />
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
#### Tag
|
|
143
|
-
|
|
144
|
-
Labeling and categorization tags.
|
|
145
|
-
|
|
146
|
-
```tsx
|
|
147
|
-
<Tag>New</Tag>
|
|
148
|
-
<Tag variant="success">Available</Tag>
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
#### StatusIndicator
|
|
152
|
-
|
|
153
|
-
Status indicator dots with labels.
|
|
154
|
-
|
|
155
|
-
```tsx
|
|
156
|
-
<StatusIndicator status="online" label="Online" />
|
|
157
|
-
<StatusIndicator status="offline" label="Offline" />
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
#### ProgressBar
|
|
161
|
-
|
|
162
|
-
Linear progress bars with labels and variants.
|
|
163
|
-
|
|
164
|
-
```tsx
|
|
165
|
-
<ProgressBar value={75} max={100} variant="primary" />
|
|
166
|
-
<ProgressBar value={50} label="50%" showLabel />
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
#### CircularProgress
|
|
170
|
-
|
|
171
|
-
Circular progress indicators.
|
|
172
|
-
|
|
173
|
-
```tsx
|
|
174
|
-
<CircularProgress value={75} size={64} />
|
|
175
|
-
<CircularProgress indeterminate size={48} />
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
#### Skeleton
|
|
179
|
-
|
|
180
|
-
Loading skeleton screens for content placeholders.
|
|
181
|
-
|
|
182
|
-
```tsx
|
|
183
|
-
<Skeleton variant="text" width="100%" />
|
|
184
|
-
<Skeleton variant="circular" width={40} height={40} />
|
|
185
|
-
<Skeleton variant="rectangular" width={200} height={100} />
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
#### KPI
|
|
189
|
-
|
|
190
|
-
Key Performance Indicator display component.
|
|
191
|
-
|
|
192
|
-
```tsx
|
|
193
|
-
<KPI
|
|
194
|
-
value="$45,231"
|
|
195
|
-
label="Total Revenue"
|
|
196
|
-
trend={12.5}
|
|
197
|
-
trendDirection="up"
|
|
198
|
-
icon={<Icon name="dollar" />}
|
|
199
|
-
/>
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
#### Stat
|
|
203
|
-
|
|
204
|
-
Statistical display component for metrics.
|
|
205
|
-
|
|
206
|
-
```tsx
|
|
207
|
-
<Stat label="Total Users" value="1,234" change="+12.5%" changeType="increase" />
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
#### List
|
|
211
|
-
|
|
212
|
-
Comprehensive list component with selection, virtualization, and keyboard navigation.
|
|
213
|
-
|
|
214
|
-
```tsx
|
|
215
|
-
<List
|
|
216
|
-
items={users}
|
|
217
|
-
renderItem={(user) => (
|
|
218
|
-
<ListItem
|
|
219
|
-
key={user.id}
|
|
220
|
-
primary={user.name}
|
|
221
|
-
secondary={user.email}
|
|
222
|
-
icon={<Icon name="user" />}
|
|
223
|
-
/>
|
|
224
|
-
)}
|
|
225
|
-
selectable
|
|
226
|
-
onSelectionChange={(selected) => console.log(selected)}
|
|
227
|
-
/>
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
#### Table
|
|
231
|
-
|
|
232
|
-
Data table component with sorting, selection, and pagination.
|
|
233
|
-
|
|
234
|
-
```tsx
|
|
235
|
-
<Table
|
|
236
|
-
data={users}
|
|
237
|
-
columns={[
|
|
238
|
-
{ key: 'name', header: 'Name', sortable: true },
|
|
239
|
-
{ key: 'email', header: 'Email' },
|
|
240
|
-
{ key: 'role', header: 'Role', sortable: true },
|
|
241
|
-
]}
|
|
242
|
-
selectable
|
|
243
|
-
pagination={{ pageSize: 10 }}
|
|
244
|
-
onSort={(key, direction) => console.log(key, direction)}
|
|
245
|
-
/>
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
### Drag and Drop
|
|
249
|
-
|
|
250
|
-
#### SortableList
|
|
251
|
-
|
|
252
|
-
Reorderable list with drag-and-drop functionality.
|
|
253
|
-
|
|
254
|
-
```tsx
|
|
255
|
-
<DndProvider>
|
|
256
|
-
<SortableList
|
|
257
|
-
items={items}
|
|
258
|
-
onReorder={(newOrder) => setItems(newOrder)}
|
|
259
|
-
renderItem={(item) => (
|
|
260
|
-
<div>
|
|
261
|
-
<DragHandle />
|
|
262
|
-
{item.label}
|
|
263
|
-
</div>
|
|
264
|
-
)}
|
|
265
|
-
/>
|
|
266
|
-
</DndProvider>
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
#### SortableGrid
|
|
270
|
-
|
|
271
|
-
Reorderable grid layout with drag-and-drop.
|
|
272
|
-
|
|
273
|
-
```tsx
|
|
274
|
-
<DndProvider>
|
|
275
|
-
<SortableGrid
|
|
276
|
-
items={gridItems}
|
|
277
|
-
columns={3}
|
|
278
|
-
onReorder={(newOrder) => setGridItems(newOrder)}
|
|
279
|
-
renderItem={(item) => <Card>{item.content}</Card>}
|
|
280
|
-
/>
|
|
281
|
-
</DndProvider>
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
#### KanbanBoard
|
|
285
|
-
|
|
286
|
-
Kanban-style board with draggable cards between columns.
|
|
287
|
-
|
|
288
|
-
```tsx
|
|
289
|
-
<DndProvider>
|
|
290
|
-
<KanbanBoard
|
|
291
|
-
columns={[
|
|
292
|
-
{ id: 'todo', title: 'To Do', items: todoItems },
|
|
293
|
-
{ id: 'progress', title: 'In Progress', items: progressItems },
|
|
294
|
-
{ id: 'done', title: 'Done', items: doneItems },
|
|
295
|
-
]}
|
|
296
|
-
onCardMove={(cardId, fromColumn, toColumn) => handleMove(cardId, fromColumn, toColumn)}
|
|
297
|
-
/>
|
|
298
|
-
</DndProvider>
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
#### ResizablePanels
|
|
302
|
-
|
|
303
|
-
Resizable panel layouts for split views.
|
|
304
|
-
|
|
305
|
-
```tsx
|
|
306
|
-
<ResizablePanels direction="horizontal">
|
|
307
|
-
<Panel defaultSize={30} minSize={20}>
|
|
308
|
-
<Sidebar />
|
|
309
|
-
</Panel>
|
|
310
|
-
<Panel>
|
|
311
|
-
<MainContent />
|
|
312
|
-
</Panel>
|
|
313
|
-
</ResizablePanels>
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
### Filters
|
|
317
|
-
|
|
318
|
-
#### Filter System
|
|
319
|
-
|
|
320
|
-
Comprehensive filtering system with various field types and layouts.
|
|
321
|
-
|
|
322
|
-
```tsx
|
|
323
|
-
<FilterProvider filters={filters} onChange={(filters) => console.log(filters)}>
|
|
324
|
-
<FilterBar>
|
|
325
|
-
<TextFilter field="name" label="Name" />
|
|
326
|
-
<SelectFilter
|
|
327
|
-
field="status"
|
|
328
|
-
label="Status"
|
|
329
|
-
options={[
|
|
330
|
-
{ value: 'active', label: 'Active' },
|
|
331
|
-
{ value: 'inactive', label: 'Inactive' },
|
|
332
|
-
]}
|
|
333
|
-
/>
|
|
334
|
-
<DateRangeFilter field="createdAt" label="Created" />
|
|
335
|
-
<NumberRangeFilter field="price" label="Price" min={0} max={1000} />
|
|
336
|
-
</FilterBar>
|
|
337
|
-
</FilterProvider>
|
|
338
|
-
```
|
|
339
|
-
|
|
340
|
-
### Inputs
|
|
341
|
-
|
|
342
|
-
#### Input
|
|
343
|
-
|
|
344
|
-
Text input with validation, formatting, and various configurations.
|
|
345
|
-
|
|
346
|
-
```tsx
|
|
347
|
-
<Input
|
|
348
|
-
label="Email"
|
|
349
|
-
type="email"
|
|
350
|
-
placeholder="Enter your email"
|
|
351
|
-
validation={(value) =>
|
|
352
|
-
value.includes('@') ? { valid: true } : { valid: false, message: 'Invalid email' }
|
|
353
|
-
}
|
|
354
|
-
/>
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
#### Autocomplete
|
|
358
|
-
|
|
359
|
-
Input with dropdown suggestions and filtering.
|
|
360
|
-
|
|
361
|
-
```tsx
|
|
362
|
-
<Autocomplete
|
|
363
|
-
options={[
|
|
364
|
-
{ value: '1', label: 'Option 1' },
|
|
365
|
-
{ value: '2', label: 'Option 2' },
|
|
366
|
-
]}
|
|
367
|
-
placeholder="Search..."
|
|
368
|
-
/>
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
#### Select
|
|
372
|
-
|
|
373
|
-
Dropdown select component with search and custom rendering.
|
|
374
|
-
|
|
375
|
-
```tsx
|
|
376
|
-
<Select
|
|
377
|
-
options={[
|
|
378
|
-
{ value: 'us', label: 'United States' },
|
|
379
|
-
{ value: 'ca', label: 'Canada' },
|
|
380
|
-
]}
|
|
381
|
-
placeholder="Select country"
|
|
382
|
-
/>
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
#### Checkbox
|
|
386
|
-
|
|
387
|
-
Checkbox input with labels and indeterminate state.
|
|
388
|
-
|
|
389
|
-
```tsx
|
|
390
|
-
<Checkbox label="Accept terms" checked={accepted} onChange={setAccepted} />
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
#### Radio & RadioGroup
|
|
394
|
-
|
|
395
|
-
Radio button inputs with group management.
|
|
396
|
-
|
|
397
|
-
```tsx
|
|
398
|
-
<RadioGroup value={selected} onChange={setSelected}>
|
|
399
|
-
<Radio value="option1" label="Option 1" />
|
|
400
|
-
<Radio value="option2" label="Option 2" />
|
|
401
|
-
</RadioGroup>
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
#### Toggle
|
|
405
|
-
|
|
406
|
-
Switch/toggle component for boolean states.
|
|
407
|
-
|
|
408
|
-
```tsx
|
|
409
|
-
<Toggle checked={enabled} onChange={setEnabled} label="Enable feature" />
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
#### Textarea
|
|
413
|
-
|
|
414
|
-
Multi-line text input with auto-resize.
|
|
415
|
-
|
|
416
|
-
```tsx
|
|
417
|
-
<Textarea label="Description" placeholder="Enter description" rows={4} maxLength={500} />
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
#### NumberInput
|
|
421
|
-
|
|
422
|
-
Numeric input with increment/decrement controls.
|
|
423
|
-
|
|
424
|
-
```tsx
|
|
425
|
-
<NumberInput label="Quantity" min={0} max={100} step={1} value={quantity} onChange={setQuantity} />
|
|
426
|
-
```
|
|
427
|
-
|
|
428
|
-
#### PhoneInput
|
|
429
|
-
|
|
430
|
-
International phone number input with country selection.
|
|
431
|
-
|
|
432
|
-
```tsx
|
|
433
|
-
<PhoneInput value={phone} onChange={setPhone} defaultCountry="US" />
|
|
434
|
-
```
|
|
435
|
-
|
|
436
|
-
#### Slider
|
|
437
|
-
|
|
438
|
-
Range slider with marks and custom formatting.
|
|
439
|
-
|
|
440
|
-
```tsx
|
|
441
|
-
<Slider min={0} max={100} value={volume} onChange={setVolume} marks={[0, 25, 50, 75, 100]} />
|
|
442
|
-
```
|
|
443
|
-
|
|
444
|
-
#### Rating
|
|
445
|
-
|
|
446
|
-
Star rating input component.
|
|
447
|
-
|
|
448
|
-
```tsx
|
|
449
|
-
<Rating value={rating} onChange={setRating} max={5} />
|
|
450
|
-
```
|
|
451
|
-
|
|
452
|
-
#### TagInput
|
|
453
|
-
|
|
454
|
-
Input for managing multiple tags.
|
|
455
|
-
|
|
456
|
-
```tsx
|
|
457
|
-
<TagInput tags={tags} onChange={setTags} placeholder="Add tag..." />
|
|
458
|
-
```
|
|
459
|
-
|
|
460
|
-
#### FilePicker
|
|
461
|
-
|
|
462
|
-
File upload component with drag-and-drop support.
|
|
463
|
-
|
|
464
|
-
```tsx
|
|
465
|
-
<FilePicker
|
|
466
|
-
accept=".pdf,.doc,.docx"
|
|
467
|
-
maxSize={5 * 1024 * 1024}
|
|
468
|
-
onChange={(files) => console.log(files)}
|
|
469
|
-
/>
|
|
470
|
-
```
|
|
471
|
-
|
|
472
|
-
#### ColorPicker
|
|
473
|
-
|
|
474
|
-
Color selection with multiple format support (hex, rgb, hsl).
|
|
475
|
-
|
|
476
|
-
```tsx
|
|
477
|
-
<ColorPicker value={color} onChange={setColor} format="hex" />
|
|
478
|
-
```
|
|
479
|
-
|
|
480
|
-
#### DatePicker
|
|
481
|
-
|
|
482
|
-
Single date selection with calendar interface.
|
|
483
|
-
|
|
484
|
-
```tsx
|
|
485
|
-
<DatePicker value={date} onChange={setDate} minDate={new Date()} />
|
|
486
|
-
```
|
|
487
|
-
|
|
488
|
-
#### DateRangePicker
|
|
489
|
-
|
|
490
|
-
Date range selection with presets.
|
|
491
|
-
|
|
492
|
-
```tsx
|
|
493
|
-
<DateRangePicker
|
|
494
|
-
startDate={startDate}
|
|
495
|
-
endDate={endDate}
|
|
496
|
-
onChange={(start, end) => {
|
|
497
|
-
setStartDate(start);
|
|
498
|
-
setEndDate(end);
|
|
499
|
-
}}
|
|
500
|
-
presets={[{ label: 'Last 7 days', value: { start: -7, end: 0 } }]}
|
|
501
|
-
/>
|
|
502
|
-
```
|
|
503
|
-
|
|
504
|
-
### Overlays
|
|
505
|
-
|
|
506
|
-
#### Portal
|
|
507
|
-
|
|
508
|
-
Render children in a different part of the DOM.
|
|
509
|
-
|
|
510
|
-
```tsx
|
|
511
|
-
<Portal>
|
|
512
|
-
<div>This renders at document.body</div>
|
|
513
|
-
</Portal>
|
|
514
|
-
```
|
|
515
|
-
|
|
516
|
-
#### Popover
|
|
517
|
-
|
|
518
|
-
Floating content positioned relative to a trigger.
|
|
519
|
-
|
|
520
|
-
```tsx
|
|
521
|
-
<Popover trigger={<Button>Open Popover</Button>} content={<div>Popover content</div>} />
|
|
522
|
-
```
|
|
523
|
-
|
|
524
|
-
#### Tooltip
|
|
525
|
-
|
|
526
|
-
Hover tooltip with customizable positioning.
|
|
527
|
-
|
|
528
|
-
```tsx
|
|
529
|
-
<Tooltip content="Helpful information" position="top">
|
|
530
|
-
<Button>Hover me</Button>
|
|
531
|
-
</Tooltip>
|
|
532
|
-
```
|
|
533
|
-
|
|
534
|
-
#### Dropdown
|
|
535
|
-
|
|
536
|
-
Dropdown menu with trigger and content.
|
|
537
|
-
|
|
538
|
-
```tsx
|
|
539
|
-
<Dropdown
|
|
540
|
-
trigger={<Button>Options</Button>}
|
|
541
|
-
content={
|
|
542
|
-
<MenuList>
|
|
543
|
-
<MenuItem>Action 1</MenuItem>
|
|
544
|
-
<MenuItem>Action 2</MenuItem>
|
|
545
|
-
</MenuList>
|
|
546
|
-
}
|
|
547
|
-
/>
|
|
548
|
-
```
|
|
549
|
-
|
|
550
|
-
#### Menu
|
|
551
|
-
|
|
552
|
-
Flexible menu system with items, groups, and dividers.
|
|
553
|
-
|
|
554
|
-
```tsx
|
|
555
|
-
<Menu>
|
|
556
|
-
<MenuList>
|
|
557
|
-
<MenuItem onClick={() => console.log('Edit')}>Edit</MenuItem>
|
|
558
|
-
<MenuItem onClick={() => console.log('Delete')}>Delete</MenuItem>
|
|
559
|
-
<MenuDivider />
|
|
560
|
-
<MenuGroup label="More options">
|
|
561
|
-
<MenuItem>Settings</MenuItem>
|
|
562
|
-
</MenuGroup>
|
|
563
|
-
</MenuList>
|
|
564
|
-
</Menu>
|
|
565
|
-
```
|
|
566
|
-
|
|
567
|
-
### Navigation
|
|
568
|
-
|
|
569
|
-
#### Stepper
|
|
570
|
-
|
|
571
|
-
Multi-step progress indicator for wizard-like interfaces.
|
|
572
|
-
|
|
573
|
-
```tsx
|
|
574
|
-
<Stepper activeStep={1}>
|
|
575
|
-
<Step label="Account" description="Create your account" />
|
|
576
|
-
<Step label="Profile" description="Set up your profile" />
|
|
577
|
-
<Step label="Review" description="Review and submit" />
|
|
578
|
-
</Stepper>
|
|
579
|
-
```
|
|
580
|
-
|
|
581
|
-
#### Breadcrumbs
|
|
582
|
-
|
|
583
|
-
Navigation breadcrumb trail for hierarchical page structure.
|
|
584
|
-
|
|
585
|
-
```tsx
|
|
586
|
-
<Breadcrumbs>
|
|
587
|
-
<BreadcrumbItem href="/">Home</BreadcrumbItem>
|
|
588
|
-
<BreadcrumbItem href="/products">Products</BreadcrumbItem>
|
|
589
|
-
<BreadcrumbItem>Current Page</BreadcrumbItem>
|
|
590
|
-
</Breadcrumbs>
|
|
591
|
-
```
|
|
592
|
-
|
|
593
|
-
#### Navbar
|
|
594
|
-
|
|
595
|
-
Responsive navigation bar with collapsible menu support.
|
|
596
|
-
|
|
597
|
-
```tsx
|
|
598
|
-
<Navbar>
|
|
599
|
-
<NavbarBrand>My App</NavbarBrand>
|
|
600
|
-
<NavbarToggle />
|
|
601
|
-
<NavbarCollapse>
|
|
602
|
-
<NavbarNav>
|
|
603
|
-
<NavLink href="/">Home</NavLink>
|
|
604
|
-
<NavLink href="/about">About</NavLink>
|
|
605
|
-
</NavbarNav>
|
|
606
|
-
<NavbarActions>
|
|
607
|
-
<Button>Sign In</Button>
|
|
608
|
-
</NavbarActions>
|
|
609
|
-
</NavbarCollapse>
|
|
610
|
-
</Navbar>
|
|
611
|
-
```
|
|
612
|
-
|
|
613
|
-
#### SideNav
|
|
614
|
-
|
|
615
|
-
Sidebar navigation with groups, items, and dividers.
|
|
616
|
-
|
|
617
|
-
```tsx
|
|
618
|
-
<SideNav>
|
|
619
|
-
<SideNavGroup label="Main">
|
|
620
|
-
<SideNavItem icon={<Icon name="home" />} href="/">
|
|
621
|
-
Dashboard
|
|
622
|
-
</SideNavItem>
|
|
623
|
-
<SideNavItem icon={<Icon name="users" />} href="/users">
|
|
624
|
-
Users
|
|
625
|
-
</SideNavItem>
|
|
626
|
-
</SideNavGroup>
|
|
627
|
-
<SideNavDivider />
|
|
628
|
-
<SideNavItem icon={<Icon name="settings" />} href="/settings">
|
|
629
|
-
Settings
|
|
630
|
-
</SideNavItem>
|
|
631
|
-
</SideNav>
|
|
632
|
-
```
|
|
633
|
-
|
|
634
|
-
#### Pagination
|
|
635
|
-
|
|
636
|
-
Page navigation with customizable controls.
|
|
637
|
-
|
|
638
|
-
```tsx
|
|
639
|
-
<Pagination currentPage={page} totalPages={10} onPageChange={setPage} showFirstLast />
|
|
640
|
-
```
|
|
641
|
-
|
|
642
|
-
#### BottomNavigation
|
|
643
|
-
|
|
644
|
-
Mobile-friendly bottom navigation bar.
|
|
645
|
-
|
|
646
|
-
```tsx
|
|
647
|
-
<BottomNavigation value={tab} onChange={setTab}>
|
|
648
|
-
<BottomNavigationItem icon={<Icon name="home" />} label="Home" value="home" />
|
|
649
|
-
<BottomNavigationItem icon={<Icon name="search" />} label="Search" value="search" />
|
|
650
|
-
<BottomNavigationItem icon={<Icon name="user" />} label="Profile" value="profile" />
|
|
651
|
-
</BottomNavigation>
|
|
652
|
-
```
|
|
653
|
-
|
|
654
|
-
#### Tabs
|
|
655
|
-
|
|
656
|
-
Tabbed content navigation.
|
|
657
|
-
|
|
658
|
-
```tsx
|
|
659
|
-
<Tabs defaultValue="tab1">
|
|
660
|
-
<TabList>
|
|
661
|
-
<Tab value="tab1">Tab 1</Tab>
|
|
662
|
-
<Tab value="tab2">Tab 2</Tab>
|
|
663
|
-
</TabList>
|
|
664
|
-
<TabPanel value="tab1">Content 1</TabPanel>
|
|
665
|
-
<TabPanel value="tab2">Content 2</TabPanel>
|
|
666
|
-
</Tabs>
|
|
667
|
-
```
|
|
668
|
-
|
|
669
|
-
### Layout
|
|
670
|
-
|
|
671
|
-
#### Panes
|
|
672
|
-
|
|
673
|
-
Resizable split pane layouts.
|
|
674
|
-
|
|
675
|
-
```tsx
|
|
676
|
-
<Panes direction="horizontal">
|
|
677
|
-
<Pane minSize={200}>Left Panel</Pane>
|
|
678
|
-
<Pane>Right Panel</Pane>
|
|
679
|
-
</Panes>
|
|
680
|
-
```
|
|
681
|
-
|
|
682
|
-
#### ResponsiveStack
|
|
683
|
-
|
|
684
|
-
Stack layout that adapts to screen size.
|
|
685
|
-
|
|
686
|
-
```tsx
|
|
687
|
-
<ResponsiveStack breakpoint={768} spacing={4}>
|
|
688
|
-
<Card>Item 1</Card>
|
|
689
|
-
<Card>Item 2</Card>
|
|
690
|
-
</ResponsiveStack>
|
|
691
|
-
```
|
|
692
|
-
|
|
693
|
-
#### AdaptiveGrid
|
|
694
|
-
|
|
695
|
-
Auto-adjusting grid layout based on container width.
|
|
696
|
-
|
|
697
|
-
```tsx
|
|
698
|
-
<AdaptiveGrid minItemWidth={250} gap={16}>
|
|
699
|
-
<Card>Item 1</Card>
|
|
700
|
-
<Card>Item 2</Card>
|
|
701
|
-
<Card>Item 3</Card>
|
|
702
|
-
</AdaptiveGrid>
|
|
703
|
-
```
|
|
704
|
-
|
|
705
|
-
#### MasonryLayout
|
|
706
|
-
|
|
707
|
-
Pinterest-style masonry grid for variable-height items.
|
|
708
|
-
|
|
709
|
-
```tsx
|
|
710
|
-
<MasonryLayout columns={3} gap={16}>
|
|
711
|
-
<Card>Short content</Card>
|
|
712
|
-
<Card>Much longer content that takes more space</Card>
|
|
713
|
-
<Card>Medium content</Card>
|
|
714
|
-
</MasonryLayout>
|
|
715
|
-
```
|
|
716
|
-
|
|
717
|
-
### Forms
|
|
718
|
-
|
|
719
|
-
#### FormBuilder
|
|
720
|
-
|
|
721
|
-
Dynamic form builder with validation and state management.
|
|
722
|
-
|
|
723
|
-
```tsx
|
|
724
|
-
<FormBuilder
|
|
725
|
-
fields={[
|
|
726
|
-
{
|
|
727
|
-
name: 'email',
|
|
728
|
-
label: 'Email',
|
|
729
|
-
type: 'email',
|
|
730
|
-
required: true,
|
|
731
|
-
validation: { pattern: /^[^\s@]+@[^\s@]+\.[^\s@]+$/ },
|
|
732
|
-
},
|
|
733
|
-
{
|
|
734
|
-
name: 'password',
|
|
735
|
-
label: 'Password',
|
|
736
|
-
type: 'password',
|
|
737
|
-
required: true,
|
|
738
|
-
},
|
|
739
|
-
]}
|
|
740
|
-
onSubmit={(values) => console.log(values)}
|
|
741
|
-
/>
|
|
742
|
-
```
|
|
743
|
-
|
|
744
|
-
## Theming
|
|
745
|
-
|
|
746
|
-
### Theme Configuration
|
|
747
|
-
|
|
748
|
-
The library includes a comprehensive theming system with 37 color families and 10 shades each, providing 370+ colors out of the box.
|
|
749
|
-
|
|
750
|
-
```tsx
|
|
751
|
-
import { GlobalProvider } from '@true-tech-team/ui-components';
|
|
752
|
-
|
|
753
|
-
function App() {
|
|
754
|
-
return (
|
|
755
|
-
<GlobalProvider
|
|
756
|
-
themeConfig={{
|
|
757
|
-
mode: 'light',
|
|
758
|
-
// Optional: override theme values
|
|
759
|
-
overrides: {
|
|
760
|
-
colors: {
|
|
761
|
-
primary: '#007bff',
|
|
762
|
-
},
|
|
763
|
-
},
|
|
764
|
-
}}
|
|
765
|
-
>
|
|
766
|
-
<YourApp />
|
|
767
|
-
</GlobalProvider>
|
|
768
|
-
);
|
|
769
|
-
}
|
|
770
|
-
```
|
|
771
|
-
|
|
772
|
-
### Toggle Theme
|
|
773
|
-
|
|
774
|
-
```tsx
|
|
775
|
-
import { useTheme } from '@true-tech-team/ui-components';
|
|
776
|
-
|
|
777
|
-
function ThemeToggle() {
|
|
778
|
-
const { mode, toggleMode } = useTheme();
|
|
779
|
-
return <button onClick={toggleMode}>Current: {mode}</button>;
|
|
780
|
-
}
|
|
781
|
-
```
|
|
782
|
-
|
|
783
|
-
### CSS Variables
|
|
784
|
-
|
|
785
|
-
All theme values are exposed as CSS variables for easy customization:
|
|
786
|
-
|
|
787
|
-
```css
|
|
788
|
-
.custom-element {
|
|
789
|
-
color: var(--theme-primary);
|
|
790
|
-
background: var(--theme-surface);
|
|
791
|
-
border-radius: var(--theme-radius-md);
|
|
792
|
-
padding: var(--theme-spacing-4);
|
|
793
|
-
}
|
|
794
|
-
```
|
|
795
|
-
|
|
796
|
-
### Utility Classes
|
|
797
|
-
|
|
798
|
-
**Spacing (4px grid):**
|
|
799
|
-
|
|
800
|
-
```html
|
|
801
|
-
<div class="m-4 p-2">Margin 16px, Padding 8px</div>
|
|
802
|
-
<div class="mt-2 mb-4 px-6">Margin top 8px, bottom 16px, padding x 24px</div>
|
|
803
|
-
```
|
|
804
|
-
|
|
805
|
-
**Flexbox:**
|
|
806
|
-
|
|
807
|
-
```html
|
|
808
|
-
<div class="flex items-center justify-between gap-4">...</div>
|
|
809
|
-
<div class="flex-col items-start">...</div>
|
|
810
|
-
```
|
|
811
|
-
|
|
812
|
-
**Grid:**
|
|
813
|
-
|
|
814
|
-
```html
|
|
815
|
-
<div class="grid grid-cols-3 gap-4">...</div>
|
|
816
|
-
```
|
|
817
|
-
|
|
818
|
-
**Colors:**
|
|
819
|
-
|
|
820
|
-
```html
|
|
821
|
-
<div class="bg-primary text-on-primary">...</div>
|
|
822
|
-
<div class="bg-surface text-on-surface">...</div>
|
|
823
|
-
```
|
|
824
|
-
|
|
825
|
-
**Typography:**
|
|
826
|
-
|
|
827
|
-
```html
|
|
828
|
-
<h1 class="text-2xl font-bold">Heading</h1>
|
|
829
|
-
<p class="text-sm text-secondary">Small text</p>
|
|
830
|
-
```
|
|
831
|
-
|
|
832
|
-
## Utility Functions
|
|
833
|
-
|
|
834
|
-
### Theme Utils
|
|
835
|
-
|
|
836
|
-
```tsx
|
|
837
|
-
import { getThemeValue, setThemeValue, pxToRem, gridSpacing } from '@true-tech-team/ui-components';
|
|
838
|
-
|
|
839
|
-
// Get theme values
|
|
840
|
-
const primaryColor = getThemeValue('--theme-primary');
|
|
841
|
-
|
|
842
|
-
// Convert pixels to rem
|
|
843
|
-
const remValue = pxToRem(16); // '1rem'
|
|
844
|
-
|
|
845
|
-
// Grid-based spacing
|
|
846
|
-
const spacing = gridSpacing(4); // '16px' (4 * 4px grid)
|
|
847
|
-
```
|
|
848
|
-
|
|
849
|
-
### Color Utils
|
|
850
|
-
|
|
851
|
-
```tsx
|
|
852
|
-
import { hexToRgb, rgbToHsl, isLightColor, getBrightness } from '@true-tech-team/ui-components';
|
|
853
|
-
|
|
854
|
-
const rgb = hexToRgb('#ff0000'); // { r: 255, g: 0, b: 0 }
|
|
855
|
-
const hsl = rgbToHsl(255, 0, 0); // { h: 0, s: 100, l: 50 }
|
|
856
|
-
const isLight = isLightColor('#ffffff'); // true
|
|
857
|
-
```
|
|
858
|
-
|
|
859
|
-
### Date Utils
|
|
860
|
-
|
|
861
|
-
```tsx
|
|
862
|
-
import { formatDate, getDaysInMonth, isDateInRange, addDays } from '@true-tech-team/ui-components';
|
|
863
|
-
|
|
864
|
-
const formatted = formatDate(new Date(), 'YYYY-MM-DD');
|
|
865
|
-
const daysInMonth = getDaysInMonth(2024, 0); // January 2024
|
|
866
|
-
const inRange = isDateInRange(date, startDate, endDate);
|
|
867
|
-
const futureDate = addDays(new Date(), 7);
|
|
868
|
-
```
|
|
869
|
-
|
|
870
|
-
### Validation Utils
|
|
871
|
-
|
|
872
|
-
```tsx
|
|
873
|
-
import { validators, combineValidators } from '@true-tech-team/ui-components';
|
|
874
|
-
|
|
875
|
-
const emailValidator = validators.email();
|
|
876
|
-
const requiredValidator = validators.required('This field is required');
|
|
877
|
-
const combined = combineValidators([requiredValidator, emailValidator]);
|
|
878
|
-
|
|
879
|
-
const result = combined('test@example.com');
|
|
880
|
-
```
|
|
881
|
-
|
|
882
|
-
## Development
|
|
883
|
-
|
|
884
|
-
### Building
|
|
885
|
-
|
|
886
|
-
```bash
|
|
887
|
-
# Build library for production
|
|
888
|
-
nx build ui-components --configuration=production
|
|
889
|
-
|
|
890
|
-
# Build for development
|
|
891
|
-
nx build ui-components --configuration=development
|
|
892
|
-
```
|
|
893
|
-
|
|
894
|
-
The build output will be in `dist/libs/ui-components/`.
|
|
895
|
-
|
|
896
|
-
### Testing
|
|
897
|
-
|
|
898
|
-
```bash
|
|
899
|
-
# Run tests
|
|
900
|
-
nx test ui-components
|
|
901
|
-
|
|
902
|
-
# Run tests in watch mode
|
|
903
|
-
nx test ui-components --watch
|
|
904
|
-
|
|
905
|
-
# Run tests with coverage
|
|
906
|
-
nx test ui-components --coverage
|
|
907
|
-
```
|
|
908
|
-
|
|
909
|
-
### Linting
|
|
910
|
-
|
|
911
|
-
```bash
|
|
912
|
-
# Lint
|
|
913
|
-
nx lint ui-components
|
|
914
|
-
|
|
915
|
-
# Lint and fix
|
|
916
|
-
nx lint ui-components --fix
|
|
917
|
-
```
|
|
918
|
-
|
|
919
|
-
### Storybook
|
|
920
|
-
|
|
921
|
-
View and interact with all components in Storybook:
|
|
922
|
-
|
|
923
|
-
```bash
|
|
924
|
-
# Start Storybook dev server
|
|
925
|
-
nx storybook ui-components
|
|
926
|
-
|
|
927
|
-
# Build Storybook static site
|
|
928
|
-
nx build-storybook ui-components
|
|
929
|
-
```
|
|
930
|
-
|
|
931
|
-
Storybook will be available at http://localhost:6006.
|
|
932
|
-
|
|
933
|
-
## Browser Support
|
|
934
|
-
|
|
935
|
-
- Chrome (latest)
|
|
936
|
-
- Firefox (latest)
|
|
937
|
-
- Safari (latest)
|
|
938
|
-
- Edge (latest)
|
|
939
|
-
|
|
940
|
-
## TypeScript
|
|
941
|
-
|
|
942
|
-
This library is written in TypeScript and includes type definitions. All components, props, and utilities are fully typed for the best development experience.
|
|
943
|
-
|
|
944
|
-
## Contributing
|
|
945
|
-
|
|
946
|
-
Contributions are welcome! Please ensure all tests pass and follow the existing code style.
|
|
947
|
-
|
|
948
|
-
## Repository
|
|
949
|
-
|
|
950
|
-
[True Tech Team UI Components Github](https://github.com/TrueTechTeam/true-tech-team/tree/master/libs/ui-components)
|
|
951
|
-
|
|
952
|
-
## Storybook
|
|
953
|
-
|
|
954
|
-
[True Tech Team React Components](https://truetechteamcomponents.netlify.app)
|
|
955
|
-
|
|
956
|
-
## License
|
|
957
|
-
|
|
958
|
-
MIT
|
|
959
|
-
|
|
1
|
+
# @true-tech-team/ui-components
|
|
2
|
+
|
|
3
|
+
A comprehensive React component library built with TypeScript, SCSS Modules, and featuring a robust theming system with dark/light mode support.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🎨 **Comprehensive Theming** - 37 color families with 10 shades each (370+ colors)
|
|
8
|
+
- 🌓 **Dark/Light Mode** - Built-in theme switching with CSS variables
|
|
9
|
+
- 📏 **4px Grid System** - Consistent spacing throughout
|
|
10
|
+
- 🎯 **Type-Safe** - Full TypeScript support with comprehensive types
|
|
11
|
+
- 🧩 **Component Library** - Reusable, customizable components
|
|
12
|
+
- 🎭 **Icon System** - SVG-based icons with easy customization
|
|
13
|
+
- 🛠️ **Utility Classes** - 500+ utility classes for rapid development
|
|
14
|
+
- 📦 **Tree-Shakeable** - Optimized bundle sizes
|
|
15
|
+
- ♿ **Accessible** - Built with accessibility in mind
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @true-tech-team/ui-components
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
### Wrap your app with GlobalProvider
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { GlobalProvider } from '@true-tech-team/ui-components';
|
|
29
|
+
|
|
30
|
+
function App() {
|
|
31
|
+
return (
|
|
32
|
+
<GlobalProvider themeConfig={{ mode: 'light' }}>
|
|
33
|
+
<YourApp />
|
|
34
|
+
</GlobalProvider>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Use components
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
import { Button, Icon } from '@true-tech-team/ui-components';
|
|
43
|
+
|
|
44
|
+
function MyComponent() {
|
|
45
|
+
return (
|
|
46
|
+
<div>
|
|
47
|
+
<Button variant="primary" size="md">
|
|
48
|
+
Click me
|
|
49
|
+
</Button>
|
|
50
|
+
|
|
51
|
+
<Button variant="outline" startIcon={<Icon name="check" size={16} />}>
|
|
52
|
+
Save
|
|
53
|
+
</Button>
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Components
|
|
60
|
+
|
|
61
|
+
### Buttons
|
|
62
|
+
|
|
63
|
+
#### Button
|
|
64
|
+
|
|
65
|
+
Versatile button component with multiple variants and sizes.
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
<Button variant="primary" size="md" onClick={() => console.log('clicked')}>
|
|
69
|
+
Click me
|
|
70
|
+
</Button>
|
|
71
|
+
|
|
72
|
+
<Button variant="outline" startIcon={<Icon name="check" />}>
|
|
73
|
+
With Icon
|
|
74
|
+
</Button>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Variants:** primary, secondary, outline, ghost
|
|
78
|
+
**Sizes:** sm, md, lg
|
|
79
|
+
|
|
80
|
+
#### IconButton
|
|
81
|
+
|
|
82
|
+
Button component optimized for icon-only display.
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
<IconButton aria-label="Close" size="md">
|
|
86
|
+
<Icon name="close" />
|
|
87
|
+
</IconButton>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Display
|
|
91
|
+
|
|
92
|
+
#### Icon
|
|
93
|
+
|
|
94
|
+
SVG-based icon system with customizable size and color.
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
<Icon name="check" size={24} color="var(--theme-primary)" />
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Available icons:** chevron-down, chevron-up, chevron-left, chevron-right, close, check, info, warning, error, eye, eye-off, user, users, building, dollar, chart-line, chart-bar, trending-down, and more
|
|
101
|
+
|
|
102
|
+
#### Avatar
|
|
103
|
+
|
|
104
|
+
User profile avatars with image, initials, and icon variants.
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
<Avatar src="/path/to/image.jpg" alt="User name" size="md" />
|
|
108
|
+
<Avatar initials="JD" size="lg" />
|
|
109
|
+
<Avatar icon={<Icon name="user" />} variant="secondary" />
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Sizes:** xs, sm, md, lg, xl
|
|
113
|
+
**Variants:** primary, secondary, tertiary
|
|
114
|
+
|
|
115
|
+
#### Badge
|
|
116
|
+
|
|
117
|
+
Notification badges with count display.
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
<Badge count={5} variant="primary" />
|
|
121
|
+
<Badge count={99} max={99} variant="error" />
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
#### Chip
|
|
125
|
+
|
|
126
|
+
Interactive chips for tags and selections.
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
<Chip label="React" onDelete={() => {}} />
|
|
130
|
+
<Chip label="TypeScript" variant="outlined" />
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
#### Pill
|
|
134
|
+
|
|
135
|
+
Status and category pills.
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
<Pill label="Active" variant="success" />
|
|
139
|
+
<Pill label="Pending" variant="warning" />
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### Tag
|
|
143
|
+
|
|
144
|
+
Labeling and categorization tags.
|
|
145
|
+
|
|
146
|
+
```tsx
|
|
147
|
+
<Tag>New</Tag>
|
|
148
|
+
<Tag variant="success">Available</Tag>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
#### StatusIndicator
|
|
152
|
+
|
|
153
|
+
Status indicator dots with labels.
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
<StatusIndicator status="online" label="Online" />
|
|
157
|
+
<StatusIndicator status="offline" label="Offline" />
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
#### ProgressBar
|
|
161
|
+
|
|
162
|
+
Linear progress bars with labels and variants.
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
<ProgressBar value={75} max={100} variant="primary" />
|
|
166
|
+
<ProgressBar value={50} label="50%" showLabel />
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
#### CircularProgress
|
|
170
|
+
|
|
171
|
+
Circular progress indicators.
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
<CircularProgress value={75} size={64} />
|
|
175
|
+
<CircularProgress indeterminate size={48} />
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
#### Skeleton
|
|
179
|
+
|
|
180
|
+
Loading skeleton screens for content placeholders.
|
|
181
|
+
|
|
182
|
+
```tsx
|
|
183
|
+
<Skeleton variant="text" width="100%" />
|
|
184
|
+
<Skeleton variant="circular" width={40} height={40} />
|
|
185
|
+
<Skeleton variant="rectangular" width={200} height={100} />
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
#### KPI
|
|
189
|
+
|
|
190
|
+
Key Performance Indicator display component.
|
|
191
|
+
|
|
192
|
+
```tsx
|
|
193
|
+
<KPI
|
|
194
|
+
value="$45,231"
|
|
195
|
+
label="Total Revenue"
|
|
196
|
+
trend={12.5}
|
|
197
|
+
trendDirection="up"
|
|
198
|
+
icon={<Icon name="dollar" />}
|
|
199
|
+
/>
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
#### Stat
|
|
203
|
+
|
|
204
|
+
Statistical display component for metrics.
|
|
205
|
+
|
|
206
|
+
```tsx
|
|
207
|
+
<Stat label="Total Users" value="1,234" change="+12.5%" changeType="increase" />
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
#### List
|
|
211
|
+
|
|
212
|
+
Comprehensive list component with selection, virtualization, and keyboard navigation.
|
|
213
|
+
|
|
214
|
+
```tsx
|
|
215
|
+
<List
|
|
216
|
+
items={users}
|
|
217
|
+
renderItem={(user) => (
|
|
218
|
+
<ListItem
|
|
219
|
+
key={user.id}
|
|
220
|
+
primary={user.name}
|
|
221
|
+
secondary={user.email}
|
|
222
|
+
icon={<Icon name="user" />}
|
|
223
|
+
/>
|
|
224
|
+
)}
|
|
225
|
+
selectable
|
|
226
|
+
onSelectionChange={(selected) => console.log(selected)}
|
|
227
|
+
/>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
#### Table
|
|
231
|
+
|
|
232
|
+
Data table component with sorting, selection, and pagination.
|
|
233
|
+
|
|
234
|
+
```tsx
|
|
235
|
+
<Table
|
|
236
|
+
data={users}
|
|
237
|
+
columns={[
|
|
238
|
+
{ key: 'name', header: 'Name', sortable: true },
|
|
239
|
+
{ key: 'email', header: 'Email' },
|
|
240
|
+
{ key: 'role', header: 'Role', sortable: true },
|
|
241
|
+
]}
|
|
242
|
+
selectable
|
|
243
|
+
pagination={{ pageSize: 10 }}
|
|
244
|
+
onSort={(key, direction) => console.log(key, direction)}
|
|
245
|
+
/>
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Drag and Drop
|
|
249
|
+
|
|
250
|
+
#### SortableList
|
|
251
|
+
|
|
252
|
+
Reorderable list with drag-and-drop functionality.
|
|
253
|
+
|
|
254
|
+
```tsx
|
|
255
|
+
<DndProvider>
|
|
256
|
+
<SortableList
|
|
257
|
+
items={items}
|
|
258
|
+
onReorder={(newOrder) => setItems(newOrder)}
|
|
259
|
+
renderItem={(item) => (
|
|
260
|
+
<div>
|
|
261
|
+
<DragHandle />
|
|
262
|
+
{item.label}
|
|
263
|
+
</div>
|
|
264
|
+
)}
|
|
265
|
+
/>
|
|
266
|
+
</DndProvider>
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
#### SortableGrid
|
|
270
|
+
|
|
271
|
+
Reorderable grid layout with drag-and-drop.
|
|
272
|
+
|
|
273
|
+
```tsx
|
|
274
|
+
<DndProvider>
|
|
275
|
+
<SortableGrid
|
|
276
|
+
items={gridItems}
|
|
277
|
+
columns={3}
|
|
278
|
+
onReorder={(newOrder) => setGridItems(newOrder)}
|
|
279
|
+
renderItem={(item) => <Card>{item.content}</Card>}
|
|
280
|
+
/>
|
|
281
|
+
</DndProvider>
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
#### KanbanBoard
|
|
285
|
+
|
|
286
|
+
Kanban-style board with draggable cards between columns.
|
|
287
|
+
|
|
288
|
+
```tsx
|
|
289
|
+
<DndProvider>
|
|
290
|
+
<KanbanBoard
|
|
291
|
+
columns={[
|
|
292
|
+
{ id: 'todo', title: 'To Do', items: todoItems },
|
|
293
|
+
{ id: 'progress', title: 'In Progress', items: progressItems },
|
|
294
|
+
{ id: 'done', title: 'Done', items: doneItems },
|
|
295
|
+
]}
|
|
296
|
+
onCardMove={(cardId, fromColumn, toColumn) => handleMove(cardId, fromColumn, toColumn)}
|
|
297
|
+
/>
|
|
298
|
+
</DndProvider>
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
#### ResizablePanels
|
|
302
|
+
|
|
303
|
+
Resizable panel layouts for split views.
|
|
304
|
+
|
|
305
|
+
```tsx
|
|
306
|
+
<ResizablePanels direction="horizontal">
|
|
307
|
+
<Panel defaultSize={30} minSize={20}>
|
|
308
|
+
<Sidebar />
|
|
309
|
+
</Panel>
|
|
310
|
+
<Panel>
|
|
311
|
+
<MainContent />
|
|
312
|
+
</Panel>
|
|
313
|
+
</ResizablePanels>
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Filters
|
|
317
|
+
|
|
318
|
+
#### Filter System
|
|
319
|
+
|
|
320
|
+
Comprehensive filtering system with various field types and layouts.
|
|
321
|
+
|
|
322
|
+
```tsx
|
|
323
|
+
<FilterProvider filters={filters} onChange={(filters) => console.log(filters)}>
|
|
324
|
+
<FilterBar>
|
|
325
|
+
<TextFilter field="name" label="Name" />
|
|
326
|
+
<SelectFilter
|
|
327
|
+
field="status"
|
|
328
|
+
label="Status"
|
|
329
|
+
options={[
|
|
330
|
+
{ value: 'active', label: 'Active' },
|
|
331
|
+
{ value: 'inactive', label: 'Inactive' },
|
|
332
|
+
]}
|
|
333
|
+
/>
|
|
334
|
+
<DateRangeFilter field="createdAt" label="Created" />
|
|
335
|
+
<NumberRangeFilter field="price" label="Price" min={0} max={1000} />
|
|
336
|
+
</FilterBar>
|
|
337
|
+
</FilterProvider>
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Inputs
|
|
341
|
+
|
|
342
|
+
#### Input
|
|
343
|
+
|
|
344
|
+
Text input with validation, formatting, and various configurations.
|
|
345
|
+
|
|
346
|
+
```tsx
|
|
347
|
+
<Input
|
|
348
|
+
label="Email"
|
|
349
|
+
type="email"
|
|
350
|
+
placeholder="Enter your email"
|
|
351
|
+
validation={(value) =>
|
|
352
|
+
value.includes('@') ? { valid: true } : { valid: false, message: 'Invalid email' }
|
|
353
|
+
}
|
|
354
|
+
/>
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
#### Autocomplete
|
|
358
|
+
|
|
359
|
+
Input with dropdown suggestions and filtering.
|
|
360
|
+
|
|
361
|
+
```tsx
|
|
362
|
+
<Autocomplete
|
|
363
|
+
options={[
|
|
364
|
+
{ value: '1', label: 'Option 1' },
|
|
365
|
+
{ value: '2', label: 'Option 2' },
|
|
366
|
+
]}
|
|
367
|
+
placeholder="Search..."
|
|
368
|
+
/>
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
#### Select
|
|
372
|
+
|
|
373
|
+
Dropdown select component with search and custom rendering.
|
|
374
|
+
|
|
375
|
+
```tsx
|
|
376
|
+
<Select
|
|
377
|
+
options={[
|
|
378
|
+
{ value: 'us', label: 'United States' },
|
|
379
|
+
{ value: 'ca', label: 'Canada' },
|
|
380
|
+
]}
|
|
381
|
+
placeholder="Select country"
|
|
382
|
+
/>
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
#### Checkbox
|
|
386
|
+
|
|
387
|
+
Checkbox input with labels and indeterminate state.
|
|
388
|
+
|
|
389
|
+
```tsx
|
|
390
|
+
<Checkbox label="Accept terms" checked={accepted} onChange={setAccepted} />
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
#### Radio & RadioGroup
|
|
394
|
+
|
|
395
|
+
Radio button inputs with group management.
|
|
396
|
+
|
|
397
|
+
```tsx
|
|
398
|
+
<RadioGroup value={selected} onChange={setSelected}>
|
|
399
|
+
<Radio value="option1" label="Option 1" />
|
|
400
|
+
<Radio value="option2" label="Option 2" />
|
|
401
|
+
</RadioGroup>
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
#### Toggle
|
|
405
|
+
|
|
406
|
+
Switch/toggle component for boolean states.
|
|
407
|
+
|
|
408
|
+
```tsx
|
|
409
|
+
<Toggle checked={enabled} onChange={setEnabled} label="Enable feature" />
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
#### Textarea
|
|
413
|
+
|
|
414
|
+
Multi-line text input with auto-resize.
|
|
415
|
+
|
|
416
|
+
```tsx
|
|
417
|
+
<Textarea label="Description" placeholder="Enter description" rows={4} maxLength={500} />
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
#### NumberInput
|
|
421
|
+
|
|
422
|
+
Numeric input with increment/decrement controls.
|
|
423
|
+
|
|
424
|
+
```tsx
|
|
425
|
+
<NumberInput label="Quantity" min={0} max={100} step={1} value={quantity} onChange={setQuantity} />
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
#### PhoneInput
|
|
429
|
+
|
|
430
|
+
International phone number input with country selection.
|
|
431
|
+
|
|
432
|
+
```tsx
|
|
433
|
+
<PhoneInput value={phone} onChange={setPhone} defaultCountry="US" />
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
#### Slider
|
|
437
|
+
|
|
438
|
+
Range slider with marks and custom formatting.
|
|
439
|
+
|
|
440
|
+
```tsx
|
|
441
|
+
<Slider min={0} max={100} value={volume} onChange={setVolume} marks={[0, 25, 50, 75, 100]} />
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
#### Rating
|
|
445
|
+
|
|
446
|
+
Star rating input component.
|
|
447
|
+
|
|
448
|
+
```tsx
|
|
449
|
+
<Rating value={rating} onChange={setRating} max={5} />
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
#### TagInput
|
|
453
|
+
|
|
454
|
+
Input for managing multiple tags.
|
|
455
|
+
|
|
456
|
+
```tsx
|
|
457
|
+
<TagInput tags={tags} onChange={setTags} placeholder="Add tag..." />
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
#### FilePicker
|
|
461
|
+
|
|
462
|
+
File upload component with drag-and-drop support.
|
|
463
|
+
|
|
464
|
+
```tsx
|
|
465
|
+
<FilePicker
|
|
466
|
+
accept=".pdf,.doc,.docx"
|
|
467
|
+
maxSize={5 * 1024 * 1024}
|
|
468
|
+
onChange={(files) => console.log(files)}
|
|
469
|
+
/>
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
#### ColorPicker
|
|
473
|
+
|
|
474
|
+
Color selection with multiple format support (hex, rgb, hsl).
|
|
475
|
+
|
|
476
|
+
```tsx
|
|
477
|
+
<ColorPicker value={color} onChange={setColor} format="hex" />
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
#### DatePicker
|
|
481
|
+
|
|
482
|
+
Single date selection with calendar interface.
|
|
483
|
+
|
|
484
|
+
```tsx
|
|
485
|
+
<DatePicker value={date} onChange={setDate} minDate={new Date()} />
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
#### DateRangePicker
|
|
489
|
+
|
|
490
|
+
Date range selection with presets.
|
|
491
|
+
|
|
492
|
+
```tsx
|
|
493
|
+
<DateRangePicker
|
|
494
|
+
startDate={startDate}
|
|
495
|
+
endDate={endDate}
|
|
496
|
+
onChange={(start, end) => {
|
|
497
|
+
setStartDate(start);
|
|
498
|
+
setEndDate(end);
|
|
499
|
+
}}
|
|
500
|
+
presets={[{ label: 'Last 7 days', value: { start: -7, end: 0 } }]}
|
|
501
|
+
/>
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
### Overlays
|
|
505
|
+
|
|
506
|
+
#### Portal
|
|
507
|
+
|
|
508
|
+
Render children in a different part of the DOM.
|
|
509
|
+
|
|
510
|
+
```tsx
|
|
511
|
+
<Portal>
|
|
512
|
+
<div>This renders at document.body</div>
|
|
513
|
+
</Portal>
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
#### Popover
|
|
517
|
+
|
|
518
|
+
Floating content positioned relative to a trigger.
|
|
519
|
+
|
|
520
|
+
```tsx
|
|
521
|
+
<Popover trigger={<Button>Open Popover</Button>} content={<div>Popover content</div>} />
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
#### Tooltip
|
|
525
|
+
|
|
526
|
+
Hover tooltip with customizable positioning.
|
|
527
|
+
|
|
528
|
+
```tsx
|
|
529
|
+
<Tooltip content="Helpful information" position="top">
|
|
530
|
+
<Button>Hover me</Button>
|
|
531
|
+
</Tooltip>
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
#### Dropdown
|
|
535
|
+
|
|
536
|
+
Dropdown menu with trigger and content.
|
|
537
|
+
|
|
538
|
+
```tsx
|
|
539
|
+
<Dropdown
|
|
540
|
+
trigger={<Button>Options</Button>}
|
|
541
|
+
content={
|
|
542
|
+
<MenuList>
|
|
543
|
+
<MenuItem>Action 1</MenuItem>
|
|
544
|
+
<MenuItem>Action 2</MenuItem>
|
|
545
|
+
</MenuList>
|
|
546
|
+
}
|
|
547
|
+
/>
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
#### Menu
|
|
551
|
+
|
|
552
|
+
Flexible menu system with items, groups, and dividers.
|
|
553
|
+
|
|
554
|
+
```tsx
|
|
555
|
+
<Menu>
|
|
556
|
+
<MenuList>
|
|
557
|
+
<MenuItem onClick={() => console.log('Edit')}>Edit</MenuItem>
|
|
558
|
+
<MenuItem onClick={() => console.log('Delete')}>Delete</MenuItem>
|
|
559
|
+
<MenuDivider />
|
|
560
|
+
<MenuGroup label="More options">
|
|
561
|
+
<MenuItem>Settings</MenuItem>
|
|
562
|
+
</MenuGroup>
|
|
563
|
+
</MenuList>
|
|
564
|
+
</Menu>
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
### Navigation
|
|
568
|
+
|
|
569
|
+
#### Stepper
|
|
570
|
+
|
|
571
|
+
Multi-step progress indicator for wizard-like interfaces.
|
|
572
|
+
|
|
573
|
+
```tsx
|
|
574
|
+
<Stepper activeStep={1}>
|
|
575
|
+
<Step label="Account" description="Create your account" />
|
|
576
|
+
<Step label="Profile" description="Set up your profile" />
|
|
577
|
+
<Step label="Review" description="Review and submit" />
|
|
578
|
+
</Stepper>
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
#### Breadcrumbs
|
|
582
|
+
|
|
583
|
+
Navigation breadcrumb trail for hierarchical page structure.
|
|
584
|
+
|
|
585
|
+
```tsx
|
|
586
|
+
<Breadcrumbs>
|
|
587
|
+
<BreadcrumbItem href="/">Home</BreadcrumbItem>
|
|
588
|
+
<BreadcrumbItem href="/products">Products</BreadcrumbItem>
|
|
589
|
+
<BreadcrumbItem>Current Page</BreadcrumbItem>
|
|
590
|
+
</Breadcrumbs>
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
#### Navbar
|
|
594
|
+
|
|
595
|
+
Responsive navigation bar with collapsible menu support.
|
|
596
|
+
|
|
597
|
+
```tsx
|
|
598
|
+
<Navbar>
|
|
599
|
+
<NavbarBrand>My App</NavbarBrand>
|
|
600
|
+
<NavbarToggle />
|
|
601
|
+
<NavbarCollapse>
|
|
602
|
+
<NavbarNav>
|
|
603
|
+
<NavLink href="/">Home</NavLink>
|
|
604
|
+
<NavLink href="/about">About</NavLink>
|
|
605
|
+
</NavbarNav>
|
|
606
|
+
<NavbarActions>
|
|
607
|
+
<Button>Sign In</Button>
|
|
608
|
+
</NavbarActions>
|
|
609
|
+
</NavbarCollapse>
|
|
610
|
+
</Navbar>
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
#### SideNav
|
|
614
|
+
|
|
615
|
+
Sidebar navigation with groups, items, and dividers.
|
|
616
|
+
|
|
617
|
+
```tsx
|
|
618
|
+
<SideNav>
|
|
619
|
+
<SideNavGroup label="Main">
|
|
620
|
+
<SideNavItem icon={<Icon name="home" />} href="/">
|
|
621
|
+
Dashboard
|
|
622
|
+
</SideNavItem>
|
|
623
|
+
<SideNavItem icon={<Icon name="users" />} href="/users">
|
|
624
|
+
Users
|
|
625
|
+
</SideNavItem>
|
|
626
|
+
</SideNavGroup>
|
|
627
|
+
<SideNavDivider />
|
|
628
|
+
<SideNavItem icon={<Icon name="settings" />} href="/settings">
|
|
629
|
+
Settings
|
|
630
|
+
</SideNavItem>
|
|
631
|
+
</SideNav>
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
#### Pagination
|
|
635
|
+
|
|
636
|
+
Page navigation with customizable controls.
|
|
637
|
+
|
|
638
|
+
```tsx
|
|
639
|
+
<Pagination currentPage={page} totalPages={10} onPageChange={setPage} showFirstLast />
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
#### BottomNavigation
|
|
643
|
+
|
|
644
|
+
Mobile-friendly bottom navigation bar.
|
|
645
|
+
|
|
646
|
+
```tsx
|
|
647
|
+
<BottomNavigation value={tab} onChange={setTab}>
|
|
648
|
+
<BottomNavigationItem icon={<Icon name="home" />} label="Home" value="home" />
|
|
649
|
+
<BottomNavigationItem icon={<Icon name="search" />} label="Search" value="search" />
|
|
650
|
+
<BottomNavigationItem icon={<Icon name="user" />} label="Profile" value="profile" />
|
|
651
|
+
</BottomNavigation>
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
#### Tabs
|
|
655
|
+
|
|
656
|
+
Tabbed content navigation.
|
|
657
|
+
|
|
658
|
+
```tsx
|
|
659
|
+
<Tabs defaultValue="tab1">
|
|
660
|
+
<TabList>
|
|
661
|
+
<Tab value="tab1">Tab 1</Tab>
|
|
662
|
+
<Tab value="tab2">Tab 2</Tab>
|
|
663
|
+
</TabList>
|
|
664
|
+
<TabPanel value="tab1">Content 1</TabPanel>
|
|
665
|
+
<TabPanel value="tab2">Content 2</TabPanel>
|
|
666
|
+
</Tabs>
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
### Layout
|
|
670
|
+
|
|
671
|
+
#### Panes
|
|
672
|
+
|
|
673
|
+
Resizable split pane layouts.
|
|
674
|
+
|
|
675
|
+
```tsx
|
|
676
|
+
<Panes direction="horizontal">
|
|
677
|
+
<Pane minSize={200}>Left Panel</Pane>
|
|
678
|
+
<Pane>Right Panel</Pane>
|
|
679
|
+
</Panes>
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
#### ResponsiveStack
|
|
683
|
+
|
|
684
|
+
Stack layout that adapts to screen size.
|
|
685
|
+
|
|
686
|
+
```tsx
|
|
687
|
+
<ResponsiveStack breakpoint={768} spacing={4}>
|
|
688
|
+
<Card>Item 1</Card>
|
|
689
|
+
<Card>Item 2</Card>
|
|
690
|
+
</ResponsiveStack>
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
#### AdaptiveGrid
|
|
694
|
+
|
|
695
|
+
Auto-adjusting grid layout based on container width.
|
|
696
|
+
|
|
697
|
+
```tsx
|
|
698
|
+
<AdaptiveGrid minItemWidth={250} gap={16}>
|
|
699
|
+
<Card>Item 1</Card>
|
|
700
|
+
<Card>Item 2</Card>
|
|
701
|
+
<Card>Item 3</Card>
|
|
702
|
+
</AdaptiveGrid>
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
#### MasonryLayout
|
|
706
|
+
|
|
707
|
+
Pinterest-style masonry grid for variable-height items.
|
|
708
|
+
|
|
709
|
+
```tsx
|
|
710
|
+
<MasonryLayout columns={3} gap={16}>
|
|
711
|
+
<Card>Short content</Card>
|
|
712
|
+
<Card>Much longer content that takes more space</Card>
|
|
713
|
+
<Card>Medium content</Card>
|
|
714
|
+
</MasonryLayout>
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
### Forms
|
|
718
|
+
|
|
719
|
+
#### FormBuilder
|
|
720
|
+
|
|
721
|
+
Dynamic form builder with validation and state management.
|
|
722
|
+
|
|
723
|
+
```tsx
|
|
724
|
+
<FormBuilder
|
|
725
|
+
fields={[
|
|
726
|
+
{
|
|
727
|
+
name: 'email',
|
|
728
|
+
label: 'Email',
|
|
729
|
+
type: 'email',
|
|
730
|
+
required: true,
|
|
731
|
+
validation: { pattern: /^[^\s@]+@[^\s@]+\.[^\s@]+$/ },
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
name: 'password',
|
|
735
|
+
label: 'Password',
|
|
736
|
+
type: 'password',
|
|
737
|
+
required: true,
|
|
738
|
+
},
|
|
739
|
+
]}
|
|
740
|
+
onSubmit={(values) => console.log(values)}
|
|
741
|
+
/>
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
## Theming
|
|
745
|
+
|
|
746
|
+
### Theme Configuration
|
|
747
|
+
|
|
748
|
+
The library includes a comprehensive theming system with 37 color families and 10 shades each, providing 370+ colors out of the box.
|
|
749
|
+
|
|
750
|
+
```tsx
|
|
751
|
+
import { GlobalProvider } from '@true-tech-team/ui-components';
|
|
752
|
+
|
|
753
|
+
function App() {
|
|
754
|
+
return (
|
|
755
|
+
<GlobalProvider
|
|
756
|
+
themeConfig={{
|
|
757
|
+
mode: 'light',
|
|
758
|
+
// Optional: override theme values
|
|
759
|
+
overrides: {
|
|
760
|
+
colors: {
|
|
761
|
+
primary: '#007bff',
|
|
762
|
+
},
|
|
763
|
+
},
|
|
764
|
+
}}
|
|
765
|
+
>
|
|
766
|
+
<YourApp />
|
|
767
|
+
</GlobalProvider>
|
|
768
|
+
);
|
|
769
|
+
}
|
|
770
|
+
```
|
|
771
|
+
|
|
772
|
+
### Toggle Theme
|
|
773
|
+
|
|
774
|
+
```tsx
|
|
775
|
+
import { useTheme } from '@true-tech-team/ui-components';
|
|
776
|
+
|
|
777
|
+
function ThemeToggle() {
|
|
778
|
+
const { mode, toggleMode } = useTheme();
|
|
779
|
+
return <button onClick={toggleMode}>Current: {mode}</button>;
|
|
780
|
+
}
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
### CSS Variables
|
|
784
|
+
|
|
785
|
+
All theme values are exposed as CSS variables for easy customization:
|
|
786
|
+
|
|
787
|
+
```css
|
|
788
|
+
.custom-element {
|
|
789
|
+
color: var(--theme-primary);
|
|
790
|
+
background: var(--theme-surface);
|
|
791
|
+
border-radius: var(--theme-radius-md);
|
|
792
|
+
padding: var(--theme-spacing-4);
|
|
793
|
+
}
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
### Utility Classes
|
|
797
|
+
|
|
798
|
+
**Spacing (4px grid):**
|
|
799
|
+
|
|
800
|
+
```html
|
|
801
|
+
<div class="m-4 p-2">Margin 16px, Padding 8px</div>
|
|
802
|
+
<div class="mt-2 mb-4 px-6">Margin top 8px, bottom 16px, padding x 24px</div>
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
**Flexbox:**
|
|
806
|
+
|
|
807
|
+
```html
|
|
808
|
+
<div class="flex items-center justify-between gap-4">...</div>
|
|
809
|
+
<div class="flex-col items-start">...</div>
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
**Grid:**
|
|
813
|
+
|
|
814
|
+
```html
|
|
815
|
+
<div class="grid grid-cols-3 gap-4">...</div>
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
**Colors:**
|
|
819
|
+
|
|
820
|
+
```html
|
|
821
|
+
<div class="bg-primary text-on-primary">...</div>
|
|
822
|
+
<div class="bg-surface text-on-surface">...</div>
|
|
823
|
+
```
|
|
824
|
+
|
|
825
|
+
**Typography:**
|
|
826
|
+
|
|
827
|
+
```html
|
|
828
|
+
<h1 class="text-2xl font-bold">Heading</h1>
|
|
829
|
+
<p class="text-sm text-secondary">Small text</p>
|
|
830
|
+
```
|
|
831
|
+
|
|
832
|
+
## Utility Functions
|
|
833
|
+
|
|
834
|
+
### Theme Utils
|
|
835
|
+
|
|
836
|
+
```tsx
|
|
837
|
+
import { getThemeValue, setThemeValue, pxToRem, gridSpacing } from '@true-tech-team/ui-components';
|
|
838
|
+
|
|
839
|
+
// Get theme values
|
|
840
|
+
const primaryColor = getThemeValue('--theme-primary');
|
|
841
|
+
|
|
842
|
+
// Convert pixels to rem
|
|
843
|
+
const remValue = pxToRem(16); // '1rem'
|
|
844
|
+
|
|
845
|
+
// Grid-based spacing
|
|
846
|
+
const spacing = gridSpacing(4); // '16px' (4 * 4px grid)
|
|
847
|
+
```
|
|
848
|
+
|
|
849
|
+
### Color Utils
|
|
850
|
+
|
|
851
|
+
```tsx
|
|
852
|
+
import { hexToRgb, rgbToHsl, isLightColor, getBrightness } from '@true-tech-team/ui-components';
|
|
853
|
+
|
|
854
|
+
const rgb = hexToRgb('#ff0000'); // { r: 255, g: 0, b: 0 }
|
|
855
|
+
const hsl = rgbToHsl(255, 0, 0); // { h: 0, s: 100, l: 50 }
|
|
856
|
+
const isLight = isLightColor('#ffffff'); // true
|
|
857
|
+
```
|
|
858
|
+
|
|
859
|
+
### Date Utils
|
|
860
|
+
|
|
861
|
+
```tsx
|
|
862
|
+
import { formatDate, getDaysInMonth, isDateInRange, addDays } from '@true-tech-team/ui-components';
|
|
863
|
+
|
|
864
|
+
const formatted = formatDate(new Date(), 'YYYY-MM-DD');
|
|
865
|
+
const daysInMonth = getDaysInMonth(2024, 0); // January 2024
|
|
866
|
+
const inRange = isDateInRange(date, startDate, endDate);
|
|
867
|
+
const futureDate = addDays(new Date(), 7);
|
|
868
|
+
```
|
|
869
|
+
|
|
870
|
+
### Validation Utils
|
|
871
|
+
|
|
872
|
+
```tsx
|
|
873
|
+
import { validators, combineValidators } from '@true-tech-team/ui-components';
|
|
874
|
+
|
|
875
|
+
const emailValidator = validators.email();
|
|
876
|
+
const requiredValidator = validators.required('This field is required');
|
|
877
|
+
const combined = combineValidators([requiredValidator, emailValidator]);
|
|
878
|
+
|
|
879
|
+
const result = combined('test@example.com');
|
|
880
|
+
```
|
|
881
|
+
|
|
882
|
+
## Development
|
|
883
|
+
|
|
884
|
+
### Building
|
|
885
|
+
|
|
886
|
+
```bash
|
|
887
|
+
# Build library for production
|
|
888
|
+
nx build ui-components --configuration=production
|
|
889
|
+
|
|
890
|
+
# Build for development
|
|
891
|
+
nx build ui-components --configuration=development
|
|
892
|
+
```
|
|
893
|
+
|
|
894
|
+
The build output will be in `dist/libs/ui-components/`.
|
|
895
|
+
|
|
896
|
+
### Testing
|
|
897
|
+
|
|
898
|
+
```bash
|
|
899
|
+
# Run tests
|
|
900
|
+
nx test ui-components
|
|
901
|
+
|
|
902
|
+
# Run tests in watch mode
|
|
903
|
+
nx test ui-components --watch
|
|
904
|
+
|
|
905
|
+
# Run tests with coverage
|
|
906
|
+
nx test ui-components --coverage
|
|
907
|
+
```
|
|
908
|
+
|
|
909
|
+
### Linting
|
|
910
|
+
|
|
911
|
+
```bash
|
|
912
|
+
# Lint
|
|
913
|
+
nx lint ui-components
|
|
914
|
+
|
|
915
|
+
# Lint and fix
|
|
916
|
+
nx lint ui-components --fix
|
|
917
|
+
```
|
|
918
|
+
|
|
919
|
+
### Storybook
|
|
920
|
+
|
|
921
|
+
View and interact with all components in Storybook:
|
|
922
|
+
|
|
923
|
+
```bash
|
|
924
|
+
# Start Storybook dev server
|
|
925
|
+
nx storybook ui-components
|
|
926
|
+
|
|
927
|
+
# Build Storybook static site
|
|
928
|
+
nx build-storybook ui-components
|
|
929
|
+
```
|
|
930
|
+
|
|
931
|
+
Storybook will be available at http://localhost:6006.
|
|
932
|
+
|
|
933
|
+
## Browser Support
|
|
934
|
+
|
|
935
|
+
- Chrome (latest)
|
|
936
|
+
- Firefox (latest)
|
|
937
|
+
- Safari (latest)
|
|
938
|
+
- Edge (latest)
|
|
939
|
+
|
|
940
|
+
## TypeScript
|
|
941
|
+
|
|
942
|
+
This library is written in TypeScript and includes type definitions. All components, props, and utilities are fully typed for the best development experience.
|
|
943
|
+
|
|
944
|
+
## Contributing
|
|
945
|
+
|
|
946
|
+
Contributions are welcome! Please ensure all tests pass and follow the existing code style.
|
|
947
|
+
|
|
948
|
+
## Repository
|
|
949
|
+
|
|
950
|
+
[True Tech Team UI Components Github](https://github.com/TrueTechTeam/true-tech-team/tree/master/libs/ui-components)
|
|
951
|
+
|
|
952
|
+
## Storybook
|
|
953
|
+
|
|
954
|
+
[True Tech Team React Components](https://truetechteamcomponents.netlify.app)
|
|
955
|
+
|
|
956
|
+
## License
|
|
957
|
+
|
|
958
|
+
MIT
|