@true-tech-team/react-components 0.0.4 → 0.0.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.
Files changed (213) hide show
  1. package/index.css +1 -1
  2. package/index.d.ts +10 -0
  3. package/index.js +1 -1
  4. package/index.mjs +15961 -6871
  5. package/lib/components/buttons/ButtonToggleGroup/ButtonToggleGroup.d.ts +79 -0
  6. package/lib/components/buttons/ButtonToggleGroup/ButtonToggleGroupContext.d.ts +38 -0
  7. package/lib/components/buttons/ButtonToggleGroup/ButtonToggleGroupItem.d.ts +37 -0
  8. package/lib/components/buttons/ButtonToggleGroup/index.d.ts +7 -0
  9. package/lib/components/buttons/ToggleButton/ToggleButton.d.ts +96 -0
  10. package/lib/components/buttons/ToggleButton/index.d.ts +3 -0
  11. package/lib/components/display/Icon/icons/BookmarkFilled.d.ts +3 -0
  12. package/lib/components/display/Icon/icons/ChevronsLeft.d.ts +3 -0
  13. package/lib/components/display/Icon/icons/ChevronsRight.d.ts +3 -0
  14. package/lib/components/display/Icon/icons/HeartFilled.d.ts +3 -0
  15. package/lib/components/display/Icon/icons/More.d.ts +3 -0
  16. package/lib/components/display/Icon/icons/StarFilled.d.ts +3 -0
  17. package/lib/components/display/Icon/icons/ThumbsUpFilled.d.ts +3 -0
  18. package/lib/components/display/Icon/icons/index.d.ts +15 -1
  19. package/lib/components/display/List/List.d.ts +6 -0
  20. package/lib/components/display/List/ListContext.d.ts +15 -0
  21. package/lib/components/display/List/ListEmpty.d.ts +25 -0
  22. package/lib/components/display/List/ListGroup.d.ts +36 -0
  23. package/lib/components/display/List/ListHeader.d.ts +62 -0
  24. package/lib/components/display/List/ListItem.d.ts +19 -0
  25. package/lib/components/display/List/ListSearch.d.ts +32 -0
  26. package/lib/components/display/List/ListSkeleton.d.ts +27 -0
  27. package/lib/components/display/List/hooks/index.d.ts +5 -0
  28. package/lib/components/display/List/hooks/useListExpand.d.ts +6 -0
  29. package/lib/components/display/List/hooks/useListFilter.d.ts +6 -0
  30. package/lib/components/display/List/hooks/useListGroups.d.ts +6 -0
  31. package/lib/components/display/List/hooks/useListKeyboardNav.d.ts +6 -0
  32. package/lib/components/display/List/hooks/useListSelection.d.ts +6 -0
  33. package/lib/components/display/List/index.d.ts +11 -0
  34. package/lib/components/display/List/types.d.ts +485 -0
  35. package/lib/components/display/List/utils.d.ts +47 -0
  36. package/lib/components/display/OverflowText/OverflowText.d.ts +81 -0
  37. package/lib/components/display/OverflowText/index.d.ts +2 -0
  38. package/lib/components/display/ScrollArea/ScrollArea.d.ts +112 -0
  39. package/lib/components/display/ScrollArea/index.d.ts +3 -0
  40. package/lib/components/display/Table/Table.d.ts +6 -0
  41. package/lib/components/display/Table/TableBody.d.ts +4 -0
  42. package/lib/components/display/Table/TableCell.d.ts +12 -0
  43. package/lib/components/display/Table/TableContext.d.ts +10 -0
  44. package/lib/components/display/Table/TableHeader.d.ts +4 -0
  45. package/lib/components/display/Table/TableRow.d.ts +9 -0
  46. package/lib/components/display/Table/TableSearch.d.ts +32 -0
  47. package/lib/components/display/Table/TableSkeleton.d.ts +12 -0
  48. package/lib/components/display/Table/hooks/index.d.ts +10 -0
  49. package/lib/components/display/Table/hooks/useInfiniteScroll.d.ts +11 -0
  50. package/lib/components/display/Table/hooks/useTableExpand.d.ts +10 -0
  51. package/lib/components/display/Table/hooks/useTableFilter.d.ts +22 -0
  52. package/lib/components/display/Table/hooks/useTableSelection.d.ts +16 -0
  53. package/lib/components/display/Table/hooks/useTableSort.d.ts +11 -0
  54. package/lib/components/display/Table/index.d.ts +13 -0
  55. package/lib/components/display/Table/types.d.ts +295 -0
  56. package/lib/components/display/Table/utils.d.ts +37 -0
  57. package/lib/components/display/Tabs/Tab.d.ts +41 -0
  58. package/lib/components/display/Tabs/TabList.d.ts +27 -0
  59. package/lib/components/display/Tabs/TabPanel.d.ts +31 -0
  60. package/lib/components/display/Tabs/Tabs.d.ts +90 -0
  61. package/lib/components/display/Tabs/TabsContext.d.ts +63 -0
  62. package/lib/components/display/Tabs/index.d.ts +11 -0
  63. package/lib/components/display/TruncatedList/TruncatedList.d.ts +69 -0
  64. package/lib/components/display/TruncatedList/index.d.ts +2 -0
  65. package/lib/components/display/index.d.ts +4 -0
  66. package/lib/components/dnd/DndProvider/DndContext.d.ts +91 -0
  67. package/lib/components/dnd/DndProvider/DndProvider.d.ts +37 -0
  68. package/lib/components/dnd/DndProvider/index.d.ts +3 -0
  69. package/lib/components/dnd/DragHandle/DragHandle.d.ts +41 -0
  70. package/lib/components/dnd/DragHandle/index.d.ts +2 -0
  71. package/lib/components/dnd/DragOverlay/DragOverlay.d.ts +39 -0
  72. package/lib/components/dnd/DragOverlay/index.d.ts +2 -0
  73. package/lib/components/dnd/KanbanBoard/KanbanBoard.d.ts +126 -0
  74. package/lib/components/dnd/KanbanBoard/KanbanBoardContext.d.ts +62 -0
  75. package/lib/components/dnd/KanbanBoard/KanbanCard.d.ts +76 -0
  76. package/lib/components/dnd/KanbanBoard/KanbanColumn.d.ts +43 -0
  77. package/lib/components/dnd/KanbanBoard/index.d.ts +5 -0
  78. package/lib/components/dnd/ResizablePanels/ResizablePanel.d.ts +53 -0
  79. package/lib/components/dnd/ResizablePanels/ResizablePanels.d.ts +43 -0
  80. package/lib/components/dnd/ResizablePanels/ResizablePanelsContext.d.ts +64 -0
  81. package/lib/components/dnd/ResizablePanels/ResizeHandle.d.ts +28 -0
  82. package/lib/components/dnd/ResizablePanels/index.d.ts +5 -0
  83. package/lib/components/dnd/SortableGrid/SortableGrid.d.ts +76 -0
  84. package/lib/components/dnd/SortableGrid/SortableGridItem.d.ts +47 -0
  85. package/lib/components/dnd/SortableGrid/index.d.ts +3 -0
  86. package/lib/components/dnd/SortableList/SortableItem.d.ts +76 -0
  87. package/lib/components/dnd/SortableList/SortableList.d.ts +98 -0
  88. package/lib/components/dnd/SortableList/SortableListContext.d.ts +42 -0
  89. package/lib/components/dnd/SortableList/index.d.ts +4 -0
  90. package/lib/components/dnd/hooks/index.d.ts +3 -0
  91. package/lib/components/dnd/hooks/useDraggable.d.ts +66 -0
  92. package/lib/components/dnd/hooks/useDroppable.d.ts +73 -0
  93. package/lib/components/dnd/hooks/useSortable.d.ts +94 -0
  94. package/lib/components/dnd/index.d.ts +8 -0
  95. package/lib/components/filters/FilterContext.d.ts +34 -0
  96. package/lib/components/filters/core/ActiveFilters/ActiveFilters.d.ts +16 -0
  97. package/lib/components/filters/core/ActiveFilters/index.d.ts +2 -0
  98. package/lib/components/filters/core/FilterField/FilterField.d.ts +17 -0
  99. package/lib/components/filters/core/FilterField/index.d.ts +2 -0
  100. package/lib/components/filters/core/FilterProvider/FilterProvider.d.ts +4 -0
  101. package/lib/components/filters/core/FilterProvider/index.d.ts +2 -0
  102. package/lib/components/filters/core/FilterSection/FilterSection.d.ts +16 -0
  103. package/lib/components/filters/core/FilterSection/index.d.ts +2 -0
  104. package/lib/components/filters/core/index.d.ts +7 -0
  105. package/lib/components/filters/fields/CheckboxFilter.d.ts +17 -0
  106. package/lib/components/filters/fields/DateFilter.d.ts +21 -0
  107. package/lib/components/filters/fields/DateRangeFilter.d.ts +19 -0
  108. package/lib/components/filters/fields/ListSelectFilter.d.ts +19 -0
  109. package/lib/components/filters/fields/MultiSelectFilter.d.ts +19 -0
  110. package/lib/components/filters/fields/NumberFilter.d.ts +19 -0
  111. package/lib/components/filters/fields/NumberRangeFilter.d.ts +19 -0
  112. package/lib/components/filters/fields/RatingFilter.d.ts +19 -0
  113. package/lib/components/filters/fields/SelectFilter.d.ts +21 -0
  114. package/lib/components/filters/fields/TextFilter.d.ts +21 -0
  115. package/lib/components/filters/fields/ToggleFilter.d.ts +17 -0
  116. package/lib/components/filters/fields/index.d.ts +25 -0
  117. package/lib/components/filters/hooks/index.d.ts +9 -0
  118. package/lib/components/filters/hooks/useFilter.d.ts +57 -0
  119. package/lib/components/filters/hooks/useFilterDependencies.d.ts +40 -0
  120. package/lib/components/filters/hooks/useFilterOptions.d.ts +70 -0
  121. package/lib/components/filters/index.d.ts +43 -0
  122. package/lib/components/filters/layouts/FilterAccordion/FilterAccordion.d.ts +15 -0
  123. package/lib/components/filters/layouts/FilterAccordion/index.d.ts +2 -0
  124. package/lib/components/filters/layouts/FilterBar/FilterBar.d.ts +18 -0
  125. package/lib/components/filters/layouts/FilterBar/index.d.ts +2 -0
  126. package/lib/components/filters/layouts/FilterModal/FilterModal.d.ts +24 -0
  127. package/lib/components/filters/layouts/FilterModal/index.d.ts +2 -0
  128. package/lib/components/filters/layouts/FilterPopover/FilterPopover.d.ts +19 -0
  129. package/lib/components/filters/layouts/FilterPopover/index.d.ts +2 -0
  130. package/lib/components/filters/layouts/FilterSidebar/FilterSidebar.d.ts +20 -0
  131. package/lib/components/filters/layouts/FilterSidebar/index.d.ts +2 -0
  132. package/lib/components/filters/layouts/index.d.ts +8 -0
  133. package/lib/components/filters/types.d.ts +937 -0
  134. package/lib/components/index.d.ts +52 -0
  135. package/lib/components/inputs/Checkbox/Checkbox.d.ts +2 -2
  136. package/lib/components/inputs/CheckboxGroup/CheckboxGroup.d.ts +122 -0
  137. package/lib/components/inputs/CheckboxGroup/CheckboxGroupContext.d.ts +42 -0
  138. package/lib/components/inputs/CheckboxGroup/CheckboxGroupItem.d.ts +50 -0
  139. package/lib/components/inputs/CheckboxGroup/index.d.ts +7 -0
  140. package/lib/components/inputs/NumberInput/NumberInput.d.ts +3 -1
  141. package/lib/components/layout/AdaptiveGrid/AdaptiveGrid.d.ts +100 -0
  142. package/lib/components/layout/AdaptiveGrid/index.d.ts +2 -0
  143. package/lib/components/layout/MasonryLayout/MasonryLayout.d.ts +74 -0
  144. package/lib/components/layout/MasonryLayout/index.d.ts +2 -0
  145. package/lib/components/layout/Panes/Pane.d.ts +72 -0
  146. package/lib/components/layout/Panes/Panes.d.ts +75 -0
  147. package/lib/components/layout/Panes/PanesContext.d.ts +60 -0
  148. package/lib/components/layout/Panes/index.d.ts +6 -0
  149. package/lib/components/layout/ResponsiveStack/ResponsiveStack.d.ts +99 -0
  150. package/lib/components/layout/ResponsiveStack/index.d.ts +2 -0
  151. package/lib/components/layout/index.d.ts +4 -0
  152. package/lib/components/navigation/BottomNavigation/BottomNavigation.d.ts +53 -0
  153. package/lib/components/navigation/BottomNavigation/BottomNavigationContext.d.ts +27 -0
  154. package/lib/components/navigation/BottomNavigation/BottomNavigationItem.d.ts +59 -0
  155. package/lib/components/navigation/BottomNavigation/index.d.ts +7 -0
  156. package/lib/components/navigation/Breadcrumbs/BreadcrumbItem.d.ts +37 -0
  157. package/lib/components/navigation/Breadcrumbs/BreadcrumbSeparator.d.ts +22 -0
  158. package/lib/components/navigation/Breadcrumbs/Breadcrumbs.d.ts +96 -0
  159. package/lib/components/navigation/Breadcrumbs/index.d.ts +9 -0
  160. package/lib/components/navigation/Breadcrumbs/useBreadcrumbsFromPath.d.ts +73 -0
  161. package/lib/components/navigation/CollapsibleSidebar/CollapsibleSidebar.d.ts +113 -0
  162. package/lib/components/navigation/CollapsibleSidebar/index.d.ts +2 -0
  163. package/lib/components/navigation/NavLink/NavLink.d.ts +74 -0
  164. package/lib/components/navigation/NavLink/index.d.ts +3 -0
  165. package/lib/components/navigation/Navbar/Navbar.d.ts +81 -0
  166. package/lib/components/navigation/Navbar/NavbarActions.d.ts +21 -0
  167. package/lib/components/navigation/Navbar/NavbarBrand.d.ts +29 -0
  168. package/lib/components/navigation/Navbar/NavbarCollapse.d.ts +26 -0
  169. package/lib/components/navigation/Navbar/NavbarContext.d.ts +50 -0
  170. package/lib/components/navigation/Navbar/NavbarNav.d.ts +22 -0
  171. package/lib/components/navigation/Navbar/NavbarToggle.d.ts +21 -0
  172. package/lib/components/navigation/Navbar/index.d.ts +15 -0
  173. package/lib/components/navigation/Pagination/Pagination.d.ts +99 -0
  174. package/lib/components/navigation/Pagination/index.d.ts +3 -0
  175. package/lib/components/navigation/SideNav/SideNav.d.ts +89 -0
  176. package/lib/components/navigation/SideNav/SideNavContext.d.ts +43 -0
  177. package/lib/components/navigation/SideNav/SideNavDivider.d.ts +22 -0
  178. package/lib/components/navigation/SideNav/SideNavGroup.d.ts +44 -0
  179. package/lib/components/navigation/SideNav/SideNavItem.d.ts +71 -0
  180. package/lib/components/navigation/SideNav/index.d.ts +11 -0
  181. package/lib/components/navigation/Stepper/Step.d.ts +57 -0
  182. package/lib/components/navigation/Stepper/Stepper.d.ts +80 -0
  183. package/lib/components/navigation/Stepper/StepperContext.d.ts +58 -0
  184. package/lib/components/navigation/Stepper/index.d.ts +7 -0
  185. package/lib/components/navigation/index.d.ts +16 -0
  186. package/lib/components/overlays/Alert/Alert.d.ts +102 -0
  187. package/lib/components/overlays/Alert/AlertContext.d.ts +94 -0
  188. package/lib/components/overlays/Alert/AlertPresets.d.ts +42 -0
  189. package/lib/components/overlays/Alert/AlertProvider.d.ts +40 -0
  190. package/lib/components/overlays/Alert/index.d.ts +11 -0
  191. package/lib/components/overlays/Dialog/Dialog.d.ts +197 -0
  192. package/lib/components/overlays/Dialog/DialogContext.d.ts +75 -0
  193. package/lib/components/overlays/Dialog/DialogProvider.d.ts +30 -0
  194. package/lib/components/overlays/Dialog/index.d.ts +9 -0
  195. package/lib/components/overlays/Toast/Toast.d.ts +103 -0
  196. package/lib/components/overlays/Toast/ToastContainer.d.ts +37 -0
  197. package/lib/components/overlays/Toast/ToastContext.d.ts +126 -0
  198. package/lib/components/overlays/Toast/ToastProvider.d.ts +71 -0
  199. package/lib/components/overlays/Toast/index.d.ts +11 -0
  200. package/lib/hooks/index.d.ts +10 -0
  201. package/lib/hooks/useAlert/index.d.ts +2 -0
  202. package/lib/hooks/useAlert/useAlert.d.ts +99 -0
  203. package/lib/hooks/useAsyncToast/index.d.ts +2 -0
  204. package/lib/hooks/useAsyncToast/useAsyncToast.d.ts +93 -0
  205. package/lib/hooks/useDialog/index.d.ts +2 -0
  206. package/lib/hooks/useDialog/useDialog.d.ts +58 -0
  207. package/lib/hooks/useResizeObserver/index.d.ts +2 -0
  208. package/lib/hooks/useResizeObserver/useResizeObserver.d.ts +69 -0
  209. package/lib/hooks/useToast/index.d.ts +2 -0
  210. package/lib/hooks/useToast/useToast.d.ts +97 -0
  211. package/lib/providers/GlobalProvider/GlobalProvider.d.ts +16 -1
  212. package/package.json +1 -1
  213. package/README.md +0 -688
package/README.md DELETED
@@ -1,688 +0,0 @@
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
52
- variant="outline"
53
- startIcon={<Icon name="check" size={16} />}
54
- >
55
- Save
56
- </Button>
57
- </div>
58
- );
59
- }
60
- ```
61
-
62
- ## Components
63
-
64
- ### Buttons
65
-
66
- #### Button
67
- Versatile button component with multiple variants and sizes.
68
-
69
- ```tsx
70
- <Button variant="primary" size="md" onClick={() => console.log('clicked')}>
71
- Click me
72
- </Button>
73
-
74
- <Button variant="outline" startIcon={<Icon name="check" />}>
75
- With Icon
76
- </Button>
77
- ```
78
-
79
- **Variants:** primary, secondary, outline, ghost
80
- **Sizes:** sm, md, lg
81
-
82
- #### IconButton
83
- Button component optimized for icon-only display.
84
-
85
- ```tsx
86
- <IconButton aria-label="Close" size="md">
87
- <Icon name="close" />
88
- </IconButton>
89
- ```
90
-
91
- ### Display
92
-
93
- #### Icon
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
- User profile avatars with image, initials, and icon variants.
104
-
105
- ```tsx
106
- <Avatar src="/path/to/image.jpg" alt="User name" size="md" />
107
- <Avatar initials="JD" size="lg" />
108
- <Avatar icon={<Icon name="user" />} variant="secondary" />
109
- ```
110
-
111
- **Sizes:** xs, sm, md, lg, xl
112
- **Variants:** primary, secondary, tertiary
113
-
114
- #### Badge
115
- Notification badges with count display.
116
-
117
- ```tsx
118
- <Badge count={5} variant="primary" />
119
- <Badge count={99} max={99} variant="error" />
120
- ```
121
-
122
- #### Chip
123
- Interactive chips for tags and selections.
124
-
125
- ```tsx
126
- <Chip label="React" onDelete={() => {}} />
127
- <Chip label="TypeScript" variant="outlined" />
128
- ```
129
-
130
- #### Pill
131
- Status and category pills.
132
-
133
- ```tsx
134
- <Pill label="Active" variant="success" />
135
- <Pill label="Pending" variant="warning" />
136
- ```
137
-
138
- #### Tag
139
- Labeling and categorization tags.
140
-
141
- ```tsx
142
- <Tag>New</Tag>
143
- <Tag variant="success">Available</Tag>
144
- ```
145
-
146
- #### StatusIndicator
147
- Status indicator dots with labels.
148
-
149
- ```tsx
150
- <StatusIndicator status="online" label="Online" />
151
- <StatusIndicator status="offline" label="Offline" />
152
- ```
153
-
154
- #### ProgressBar
155
- Linear progress bars with labels and variants.
156
-
157
- ```tsx
158
- <ProgressBar value={75} max={100} variant="primary" />
159
- <ProgressBar value={50} label="50%" showLabel />
160
- ```
161
-
162
- #### CircularProgress
163
- Circular progress indicators.
164
-
165
- ```tsx
166
- <CircularProgress value={75} size={64} />
167
- <CircularProgress indeterminate size={48} />
168
- ```
169
-
170
- #### Skeleton
171
- Loading skeleton screens for content placeholders.
172
-
173
- ```tsx
174
- <Skeleton variant="text" width="100%" />
175
- <Skeleton variant="circular" width={40} height={40} />
176
- <Skeleton variant="rectangular" width={200} height={100} />
177
- ```
178
-
179
- #### KPI
180
- Key Performance Indicator display component.
181
-
182
- ```tsx
183
- <KPI
184
- value="$45,231"
185
- label="Total Revenue"
186
- trend={12.5}
187
- trendDirection="up"
188
- icon={<Icon name="dollar" />}
189
- />
190
- ```
191
-
192
- #### Stat
193
- Statistical display component for metrics.
194
-
195
- ```tsx
196
- <Stat
197
- label="Total Users"
198
- value="1,234"
199
- change="+12.5%"
200
- changeType="increase"
201
- />
202
- ```
203
-
204
- ### Inputs
205
-
206
- #### Input
207
- Text input with validation, formatting, and various configurations.
208
-
209
- ```tsx
210
- <Input
211
- label="Email"
212
- type="email"
213
- placeholder="Enter your email"
214
- validation={(value) => value.includes('@') ? { valid: true } : { valid: false, message: 'Invalid email' }}
215
- />
216
- ```
217
-
218
- #### Autocomplete
219
- Input with dropdown suggestions and filtering.
220
-
221
- ```tsx
222
- <Autocomplete
223
- options={[
224
- { value: '1', label: 'Option 1' },
225
- { value: '2', label: 'Option 2' }
226
- ]}
227
- placeholder="Search..."
228
- />
229
- ```
230
-
231
- #### Select
232
- Dropdown select component with search and custom rendering.
233
-
234
- ```tsx
235
- <Select
236
- options={[
237
- { value: 'us', label: 'United States' },
238
- { value: 'ca', label: 'Canada' }
239
- ]}
240
- placeholder="Select country"
241
- />
242
- ```
243
-
244
- #### Checkbox
245
- Checkbox input with labels and indeterminate state.
246
-
247
- ```tsx
248
- <Checkbox label="Accept terms" checked={accepted} onChange={setAccepted} />
249
- ```
250
-
251
- #### Radio & RadioGroup
252
- Radio button inputs with group management.
253
-
254
- ```tsx
255
- <RadioGroup value={selected} onChange={setSelected}>
256
- <Radio value="option1" label="Option 1" />
257
- <Radio value="option2" label="Option 2" />
258
- </RadioGroup>
259
- ```
260
-
261
- #### Toggle
262
- Switch/toggle component for boolean states.
263
-
264
- ```tsx
265
- <Toggle checked={enabled} onChange={setEnabled} label="Enable feature" />
266
- ```
267
-
268
- #### Textarea
269
- Multi-line text input with auto-resize.
270
-
271
- ```tsx
272
- <Textarea
273
- label="Description"
274
- placeholder="Enter description"
275
- rows={4}
276
- maxLength={500}
277
- />
278
- ```
279
-
280
- #### NumberInput
281
- Numeric input with increment/decrement controls.
282
-
283
- ```tsx
284
- <NumberInput
285
- label="Quantity"
286
- min={0}
287
- max={100}
288
- step={1}
289
- value={quantity}
290
- onChange={setQuantity}
291
- />
292
- ```
293
-
294
- #### PhoneInput
295
- International phone number input with country selection.
296
-
297
- ```tsx
298
- <PhoneInput
299
- value={phone}
300
- onChange={setPhone}
301
- defaultCountry="US"
302
- />
303
- ```
304
-
305
- #### Slider
306
- Range slider with marks and custom formatting.
307
-
308
- ```tsx
309
- <Slider
310
- min={0}
311
- max={100}
312
- value={volume}
313
- onChange={setVolume}
314
- marks={[0, 25, 50, 75, 100]}
315
- />
316
- ```
317
-
318
- #### Rating
319
- Star rating input component.
320
-
321
- ```tsx
322
- <Rating value={rating} onChange={setRating} max={5} />
323
- ```
324
-
325
- #### TagInput
326
- Input for managing multiple tags.
327
-
328
- ```tsx
329
- <TagInput
330
- tags={tags}
331
- onChange={setTags}
332
- placeholder="Add tag..."
333
- />
334
- ```
335
-
336
- #### FilePicker
337
- File upload component with drag-and-drop support.
338
-
339
- ```tsx
340
- <FilePicker
341
- accept=".pdf,.doc,.docx"
342
- maxSize={5 * 1024 * 1024}
343
- onChange={(files) => console.log(files)}
344
- />
345
- ```
346
-
347
- #### ColorPicker
348
- Color selection with multiple format support (hex, rgb, hsl).
349
-
350
- ```tsx
351
- <ColorPicker
352
- value={color}
353
- onChange={setColor}
354
- format="hex"
355
- />
356
- ```
357
-
358
- #### DatePicker
359
- Single date selection with calendar interface.
360
-
361
- ```tsx
362
- <DatePicker
363
- value={date}
364
- onChange={setDate}
365
- minDate={new Date()}
366
- />
367
- ```
368
-
369
- #### DateRangePicker
370
- Date range selection with presets.
371
-
372
- ```tsx
373
- <DateRangePicker
374
- startDate={startDate}
375
- endDate={endDate}
376
- onChange={(start, end) => {
377
- setStartDate(start);
378
- setEndDate(end);
379
- }}
380
- presets={[
381
- { label: 'Last 7 days', value: { start: -7, end: 0 } }
382
- ]}
383
- />
384
- ```
385
-
386
- ### Overlays
387
-
388
- #### Portal
389
- Render children in a different part of the DOM.
390
-
391
- ```tsx
392
- <Portal>
393
- <div>This renders at document.body</div>
394
- </Portal>
395
- ```
396
-
397
- #### Popover
398
- Floating content positioned relative to a trigger.
399
-
400
- ```tsx
401
- <Popover
402
- trigger={<Button>Open Popover</Button>}
403
- content={<div>Popover content</div>}
404
- />
405
- ```
406
-
407
- #### Tooltip
408
- Hover tooltip with customizable positioning.
409
-
410
- ```tsx
411
- <Tooltip content="Helpful information" position="top">
412
- <Button>Hover me</Button>
413
- </Tooltip>
414
- ```
415
-
416
- #### Dropdown
417
- Dropdown menu with trigger and content.
418
-
419
- ```tsx
420
- <Dropdown
421
- trigger={<Button>Options</Button>}
422
- content={
423
- <MenuList>
424
- <MenuItem>Action 1</MenuItem>
425
- <MenuItem>Action 2</MenuItem>
426
- </MenuList>
427
- }
428
- />
429
- ```
430
-
431
- #### Menu
432
- Flexible menu system with items, groups, and dividers.
433
-
434
- ```tsx
435
- <Menu>
436
- <MenuList>
437
- <MenuItem onClick={() => console.log('Edit')}>Edit</MenuItem>
438
- <MenuItem onClick={() => console.log('Delete')}>Delete</MenuItem>
439
- <MenuDivider />
440
- <MenuGroup label="More options">
441
- <MenuItem>Settings</MenuItem>
442
- </MenuGroup>
443
- </MenuList>
444
- </Menu>
445
- ```
446
-
447
- ### Forms
448
-
449
- #### FormBuilder
450
- Dynamic form builder with validation and state management.
451
-
452
- ```tsx
453
- <FormBuilder
454
- fields={[
455
- {
456
- name: 'email',
457
- label: 'Email',
458
- type: 'email',
459
- required: true,
460
- validation: { pattern: /^[^\s@]+@[^\s@]+\.[^\s@]+$/ }
461
- },
462
- {
463
- name: 'password',
464
- label: 'Password',
465
- type: 'password',
466
- required: true
467
- }
468
- ]}
469
- onSubmit={(values) => console.log(values)}
470
- />
471
- ```
472
-
473
- ## Theming
474
-
475
- ### Theme Configuration
476
-
477
- The library includes a comprehensive theming system with 37 color families and 10 shades each, providing 370+ colors out of the box.
478
-
479
- ```tsx
480
- import { GlobalProvider } from '@true-tech-team/ui-components';
481
-
482
- function App() {
483
- return (
484
- <GlobalProvider
485
- themeConfig={{
486
- mode: 'light',
487
- // Optional: override theme values
488
- overrides: {
489
- colors: {
490
- primary: '#007bff'
491
- }
492
- }
493
- }}
494
- >
495
- <YourApp />
496
- </GlobalProvider>
497
- );
498
- }
499
- ```
500
-
501
- ### Toggle Theme
502
-
503
- ```tsx
504
- import { useTheme } from '@true-tech-team/ui-components';
505
-
506
- function ThemeToggle() {
507
- const { mode, toggleMode } = useTheme();
508
- return <button onClick={toggleMode}>Current: {mode}</button>;
509
- }
510
- ```
511
-
512
- ### CSS Variables
513
-
514
- All theme values are exposed as CSS variables for easy customization:
515
-
516
- ```css
517
- .custom-element {
518
- color: var(--theme-primary);
519
- background: var(--theme-surface);
520
- border-radius: var(--theme-radius-md);
521
- padding: var(--theme-spacing-4);
522
- }
523
- ```
524
-
525
- ### Utility Classes
526
-
527
- **Spacing (4px grid):**
528
- ```html
529
- <div class="m-4 p-2">Margin 16px, Padding 8px</div>
530
- <div class="mt-2 mb-4 px-6">Margin top 8px, bottom 16px, padding x 24px</div>
531
- ```
532
-
533
- **Flexbox:**
534
- ```html
535
- <div class="flex items-center justify-between gap-4">...</div>
536
- <div class="flex-col items-start">...</div>
537
- ```
538
-
539
- **Grid:**
540
- ```html
541
- <div class="grid grid-cols-3 gap-4">...</div>
542
- ```
543
-
544
- **Colors:**
545
- ```html
546
- <div class="bg-primary text-on-primary">...</div>
547
- <div class="bg-surface text-on-surface">...</div>
548
- ```
549
-
550
- **Typography:**
551
- ```html
552
- <h1 class="text-2xl font-bold">Heading</h1>
553
- <p class="text-sm text-secondary">Small text</p>
554
- ```
555
-
556
- ## Utility Functions
557
-
558
- ### Theme Utils
559
-
560
- ```tsx
561
- import { getThemeValue, setThemeValue, pxToRem, gridSpacing } from '@true-tech-team/ui-components';
562
-
563
- // Get theme values
564
- const primaryColor = getThemeValue('--theme-primary');
565
-
566
- // Convert pixels to rem
567
- const remValue = pxToRem(16); // '1rem'
568
-
569
- // Grid-based spacing
570
- const spacing = gridSpacing(4); // '16px' (4 * 4px grid)
571
- ```
572
-
573
- ### Color Utils
574
-
575
- ```tsx
576
- import {
577
- hexToRgb,
578
- rgbToHsl,
579
- isLightColor,
580
- getBrightness
581
- } from '@true-tech-team/ui-components';
582
-
583
- const rgb = hexToRgb('#ff0000'); // { r: 255, g: 0, b: 0 }
584
- const hsl = rgbToHsl(255, 0, 0); // { h: 0, s: 100, l: 50 }
585
- const isLight = isLightColor('#ffffff'); // true
586
- ```
587
-
588
- ### Date Utils
589
-
590
- ```tsx
591
- import {
592
- formatDate,
593
- getDaysInMonth,
594
- isDateInRange,
595
- addDays
596
- } from '@true-tech-team/ui-components';
597
-
598
- const formatted = formatDate(new Date(), 'YYYY-MM-DD');
599
- const daysInMonth = getDaysInMonth(2024, 0); // January 2024
600
- const inRange = isDateInRange(date, startDate, endDate);
601
- const futureDate = addDays(new Date(), 7);
602
- ```
603
-
604
- ### Validation Utils
605
-
606
- ```tsx
607
- import { validators, combineValidators } from '@true-tech-team/ui-components';
608
-
609
- const emailValidator = validators.email();
610
- const requiredValidator = validators.required('This field is required');
611
- const combined = combineValidators([requiredValidator, emailValidator]);
612
-
613
- const result = combined('test@example.com');
614
- ```
615
-
616
- ## Development
617
-
618
- ### Building
619
-
620
- ```bash
621
- # Build library for production
622
- nx build ui-components --configuration=production
623
-
624
- # Build for development
625
- nx build ui-components --configuration=development
626
- ```
627
-
628
- The build output will be in `dist/libs/ui-components/`.
629
-
630
- ### Testing
631
-
632
- ```bash
633
- # Run tests
634
- nx test ui-components
635
-
636
- # Run tests in watch mode
637
- nx test ui-components --watch
638
-
639
- # Run tests with coverage
640
- nx test ui-components --coverage
641
- ```
642
-
643
- ### Linting
644
-
645
- ```bash
646
- # Lint
647
- nx lint ui-components
648
-
649
- # Lint and fix
650
- nx lint ui-components --fix
651
- ```
652
-
653
- ### Storybook
654
-
655
- View and interact with all components in Storybook:
656
-
657
- ```bash
658
- # Start Storybook dev server
659
- nx storybook ui-components
660
-
661
- # Build Storybook static site
662
- nx build-storybook ui-components
663
- ```
664
-
665
- Storybook will be available at [http://localhost:6006](http://localhost:6006).
666
-
667
- ## Browser Support
668
-
669
- - Chrome (latest)
670
- - Firefox (latest)
671
- - Safari (latest)
672
- - Edge (latest)
673
-
674
- ## TypeScript
675
-
676
- This library is written in TypeScript and includes type definitions. All components, props, and utilities are fully typed for the best development experience.
677
-
678
- ## Contributing
679
-
680
- Contributions are welcome! Please ensure all tests pass and follow the existing code style.
681
-
682
- ## Repository
683
-
684
- [https://github.com/true-tech-team/true-tech-team](https://github.com/true-tech-team/true-tech-team)
685
-
686
- ## License
687
-
688
- MIT