@iqworksai/common-components 0.1.6 → 0.1.8
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/CHANGELOG.md +27 -27
- package/README.md +513 -398
- package/dist/.gitkeep +3 -3
- package/dist/assets/style-C92vHVlQ.css +1 -0
- package/dist/components/DbSchemaBrowser/index.d.ts.map +1 -1
- package/dist/components/FileBrowser/index.d.ts.map +1 -1
- package/dist/components/Logos/index.d.ts +30 -0
- package/dist/components/Logos/index.d.ts.map +1 -0
- package/dist/index-CTcT_r8P.cjs +159 -0
- package/dist/{index-DP9UJxKj.mjs → index-D5bh8vfG.js} +1 -1
- package/dist/{index-C8WFq_Oa.mjs → index-Wp7zHdHm.js} +10042 -9977
- package/dist/{index-B5LtRiCc.js → index-z3URHOIw.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +78 -75
- package/dist/jquery-B3k-KdWY.js +3641 -0
- package/dist/jquery-DkYZhXT6.cjs +13 -0
- package/dist/{jstree-4Yq5ootY.js → jstree-B3NPxTf-.cjs} +3 -3
- package/dist/{jstree-CHYWwh_2.mjs → jstree-Be7CGFxz.js} +13 -13
- package/package.json +130 -129
- package/dist/index-CEYAqBxa.js +0 -159
- package/dist/jquery-C4l3p_gF.js +0 -13
- package/dist/jquery-CXp5_bMd.js +0 -1
- package/dist/jquery-CZKSOerm.mjs +0 -3622
- package/dist/jquery-CwXVlshf.mjs +0 -26
- package/dist/style.css +0 -1
package/README.md
CHANGED
|
@@ -1,398 +1,513 @@
|
|
|
1
|
-
# @iqworksai/common-components
|
|
2
|
-
|
|
3
|
-
A reusable React component library and utilities package for IQWorks applications. Provides
|
|
4
|
-
|
|
5
|
-
## 🎉 Current Status
|
|
6
|
-
|
|
7
|
-
**Progress:
|
|
8
|
-
|
|
9
|
-
### ✅ Completed Categories
|
|
10
|
-
- ✅ **Context Providers**: 4/4 (100%) - ThemeProvider, LoaderProvider, ToastProvider, ContextProvider
|
|
11
|
-
- ✅ **Hooks**: 7/7 (100%) - All custom hooks migrated
|
|
12
|
-
- ✅ **Basic UI Components**: 13/13 (100%) - Alert, Modal, Toast, ToolTip, StatusBadge, etc.
|
|
13
|
-
- ✅ **Chart Components**: 7/7 (100%) - DonutChart, PieChart, BarCharts, GaugeChart, GeoChart, StorageChart
|
|
14
|
-
- ✅ **Chart Helper Components**: 3/3 (100%) - NoDataChart, ChartHeader, CustomLegends
|
|
15
|
-
- ✅ **Utility Components**: 4/4 (100%) - ConfirmationModal, Timer, ErrorBoundary, ComponentErrorBoundary
|
|
16
|
-
- ✅ **Form Components**: 4/4 (100%) - Dropdown, MultiSelect, Table, CSVImporter
|
|
17
|
-
- ✅ **Specialized Components**:
|
|
18
|
-
|
|
19
|
-
### ⏳ In Progress
|
|
20
|
-
- 🔄 **FilterModal** - Advanced filtering modal (next priority)
|
|
21
|
-
- 📋 **Remaining Components**:
|
|
22
|
-
|
|
23
|
-
## Features
|
|
24
|
-
|
|
25
|
-
- 🎨 **
|
|
26
|
-
- 🪝 **7 Custom Hooks** - Reusable React hooks for common patterns (debounce, API caching, click outside, etc.)
|
|
27
|
-
- 🎯 **4 Context Providers** - Theme, Toast, Loader, and main Context providers
|
|
28
|
-
- 🛠️ **Utility Functions** - Data transformation, risk scoring, status configuration, and more
|
|
29
|
-
- 📚 **Storybook Documentation** - Interactive component documentation with live examples for all migrated components
|
|
30
|
-
- 🎯 **TypeScript** - Full TypeScript support with comprehensive type definitions
|
|
31
|
-
- 🌲 **Tree-shakeable** - Optimized for bundle size with ES modules
|
|
32
|
-
- ♿ **Accessible** - WCAG compliant components with keyboard navigation support
|
|
33
|
-
- 🎨 **Tailwind CSS** - Styled with Tailwind CSS for easy customization
|
|
34
|
-
- 🌓 **Dark Mode** - Full dark mode support via CSS variables and ThemeProvider
|
|
35
|
-
- 🔌 **Optional Dependencies** - Redux and React Router are optional, making the library flexible
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
<
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
- **
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
- **
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
- **
|
|
160
|
-
- **
|
|
161
|
-
- **
|
|
162
|
-
- **
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
- **
|
|
166
|
-
- **
|
|
167
|
-
- **
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
- **
|
|
173
|
-
- **
|
|
174
|
-
- **
|
|
175
|
-
- **
|
|
176
|
-
- **
|
|
177
|
-
- **
|
|
178
|
-
- **
|
|
179
|
-
- **
|
|
180
|
-
- **
|
|
181
|
-
- **
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
-
|
|
188
|
-
-
|
|
189
|
-
-
|
|
190
|
-
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
-
|
|
196
|
-
-
|
|
197
|
-
-
|
|
198
|
-
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
-
|
|
234
|
-
-
|
|
235
|
-
-
|
|
236
|
-
-
|
|
237
|
-
-
|
|
238
|
-
-
|
|
239
|
-
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
-
|
|
283
|
-
-
|
|
284
|
-
-
|
|
285
|
-
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
-
|
|
320
|
-
-
|
|
321
|
-
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
-
|
|
369
|
-
-
|
|
370
|
-
-
|
|
371
|
-
-
|
|
372
|
-
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
1
|
+
# @iqworksai/common-components
|
|
2
|
+
|
|
3
|
+
A reusable React component library and utilities package for IQWorks applications. Provides 37+ UI components (80% complete), custom hooks, context providers, and utility functions extracted from DiscoverIQ Desktop. Fully SSR-compatible and Next.js ready.
|
|
4
|
+
|
|
5
|
+
## 🎉 Current Status
|
|
6
|
+
|
|
7
|
+
**Progress: 37 out of 46 components migrated (80%)**
|
|
8
|
+
|
|
9
|
+
### ✅ Completed Categories
|
|
10
|
+
- ✅ **Context Providers**: 4/4 (100%) - ThemeProvider, LoaderProvider, ToastProvider, ContextProvider
|
|
11
|
+
- ✅ **Hooks**: 7/7 (100%) - All custom hooks migrated
|
|
12
|
+
- ✅ **Basic UI Components**: 13/13 (100%) - Alert, Modal, Toast, ToolTip, StatusBadge, etc.
|
|
13
|
+
- ✅ **Chart Components**: 7/7 (100%) - DonutChart, PieChart, BarCharts, GaugeChart, GeoChart, StorageChart
|
|
14
|
+
- ✅ **Chart Helper Components**: 3/3 (100%) - NoDataChart, ChartHeader, CustomLegends
|
|
15
|
+
- ✅ **Utility Components**: 4/4 (100%) - ConfirmationModal, Timer, ErrorBoundary, ComponentErrorBoundary
|
|
16
|
+
- ✅ **Form Components**: 4/4 (100%) - Dropdown, MultiSelect, Table, CSVImporter
|
|
17
|
+
- ✅ **Specialized Components**: 6/6 (100%) - TaskResult, InstallUpdateLoader, ConfidenceScoreTooltip, ImagePreviewModal, FileBrowser, DbSchemaBrowser
|
|
18
|
+
|
|
19
|
+
### ⏳ In Progress
|
|
20
|
+
- 🔄 **FilterModal** - Advanced filtering modal (next priority)
|
|
21
|
+
- 📋 **Remaining Components**: 9 components remaining (MixedScanResults, NotificationQueue, etc.)
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
- 🎨 **37+ UI Components** - Comprehensive set of React components including modals, charts, forms, file browsers, and data display components
|
|
26
|
+
- 🪝 **7 Custom Hooks** - Reusable React hooks for common patterns (debounce, API caching, click outside, etc.)
|
|
27
|
+
- 🎯 **4 Context Providers** - Theme, Toast, Loader, and main Context providers
|
|
28
|
+
- 🛠️ **Utility Functions** - Data transformation, risk scoring, status configuration, file browser utilities, and more
|
|
29
|
+
- 📚 **Storybook Documentation** - Interactive component documentation with live examples for all migrated components
|
|
30
|
+
- 🎯 **TypeScript** - Full TypeScript support with comprehensive type definitions
|
|
31
|
+
- 🌲 **Tree-shakeable** - Optimized for bundle size with ES modules
|
|
32
|
+
- ♿ **Accessible** - WCAG compliant components with keyboard navigation support
|
|
33
|
+
- 🎨 **Tailwind CSS** - Styled with Tailwind CSS for easy customization
|
|
34
|
+
- 🌓 **Dark Mode** - Full dark mode support via CSS variables and ThemeProvider
|
|
35
|
+
- 🔌 **Optional Dependencies** - Redux and React Router are optional, making the library flexible
|
|
36
|
+
- ⚡ **SSR Compatible** - Components are SSR-safe and work with Next.js (jQuery, jstree, and ReactFlow load client-side only)
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install @iqworksai/common-components
|
|
42
|
+
# or
|
|
43
|
+
yarn add @iqworksai/common-components
|
|
44
|
+
# or
|
|
45
|
+
pnpm add @iqworksai/common-components
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
### Basic Setup
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import { ThemeProvider, ToastProvider } from '@iqworksai/common-components';
|
|
54
|
+
|
|
55
|
+
function App() {
|
|
56
|
+
return (
|
|
57
|
+
<ThemeProvider>
|
|
58
|
+
<ToastProvider>
|
|
59
|
+
{/* Your app content */}
|
|
60
|
+
</ToastProvider>
|
|
61
|
+
</ThemeProvider>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Using Components
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
import { Alert, Modal, Loader, Table } from '@iqworksai/common-components';
|
|
70
|
+
|
|
71
|
+
function MyComponent() {
|
|
72
|
+
return (
|
|
73
|
+
<div>
|
|
74
|
+
<Alert message="Welcome!" type="success" />
|
|
75
|
+
<Loader loading={true} />
|
|
76
|
+
<Table data={myData} columns={myColumns} />
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Using Hooks
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
import { useDebounce, useClickOutside } from '@iqworksai/common-components';
|
|
86
|
+
|
|
87
|
+
function SearchComponent() {
|
|
88
|
+
const [searchTerm, setSearchTerm] = useState('');
|
|
89
|
+
const debouncedSearch = useDebounce(searchTerm, 500);
|
|
90
|
+
|
|
91
|
+
// Use debouncedSearch for API calls
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Using Utilities
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
import {
|
|
99
|
+
formatBytes,
|
|
100
|
+
getStatusConfig,
|
|
101
|
+
getRiskScoreInfo,
|
|
102
|
+
convertScanObjectToFiledata,
|
|
103
|
+
formatDateTime,
|
|
104
|
+
convertScanObjectToDbSchema
|
|
105
|
+
} from '@iqworksai/common-components';
|
|
106
|
+
|
|
107
|
+
const size = formatBytes(1024); // "1 KB"
|
|
108
|
+
const status = getStatusConfig('successful'); // Status configuration with icon and colors
|
|
109
|
+
const riskInfo = getRiskScoreInfo(75); // Risk level information
|
|
110
|
+
const fileData = convertScanObjectToFiledata(scanObject); // Convert scan object to file metadata
|
|
111
|
+
const dbSchema = convertScanObjectToDbSchema(scanObject); // Convert scan object to database schema
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Using FileBrowser and DbSchemaBrowser
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
import { FileBrowser, DbSchemaBrowser } from '@iqworksai/common-components';
|
|
118
|
+
|
|
119
|
+
// FileBrowser requires an API interface
|
|
120
|
+
const fileBrowserApi = {
|
|
121
|
+
readIndexScanObjectsForPath: async (uuid, path, filters, search, page, pageSize, isScanCompleted) => {
|
|
122
|
+
// Your API implementation
|
|
123
|
+
return { data: [], hasMore: false };
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
<FileBrowser
|
|
128
|
+
scanConnectorUuid="uuid"
|
|
129
|
+
api={fileBrowserApi}
|
|
130
|
+
isEditable={true}
|
|
131
|
+
/>
|
|
132
|
+
|
|
133
|
+
// DbSchemaBrowser also requires an API interface
|
|
134
|
+
const dbSchemaApi = {
|
|
135
|
+
readIndexScanObjects: async (uuid) => ({ data: [] }),
|
|
136
|
+
readConfig: async (options) => ({ data: [] }),
|
|
137
|
+
readScanReportDetails: async (options) => ({}),
|
|
138
|
+
startSelectedTableScan: async (params) => 'success'
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
<DbSchemaBrowser
|
|
142
|
+
scanConnectorUuid="uuid"
|
|
143
|
+
api={dbSchemaApi}
|
|
144
|
+
connectionType="mssql"
|
|
145
|
+
isEditable={true}
|
|
146
|
+
/>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Documentation
|
|
150
|
+
|
|
151
|
+
- **Storybook Documentation** - Run `npm run storybook` to view interactive component playground with live examples
|
|
152
|
+
- **[Next Steps](./NEXT_STEPS.md)** - Detailed migration progress and roadmap
|
|
153
|
+
- **[Component Migration Guide](./COMPONENT_MIGRATION_GUIDE.md)** - Guidelines for migrating components
|
|
154
|
+
- **[Setup Progress](./SETUP_PROGRESS.md)** - Setup and configuration progress
|
|
155
|
+
|
|
156
|
+
### Recent Accomplishments
|
|
157
|
+
|
|
158
|
+
- ✅ **FileBrowser Component** - File browsing interface with hierarchical tree view, search, pagination, and metadata display (SSR-safe for Next.js)
|
|
159
|
+
- ✅ **DbSchemaBrowser Component** - Interactive database schema browser with graph visualization, table selection, and attribute mapping (SSR-safe for Next.js)
|
|
160
|
+
- ✅ **CSVImporter Component** - CSV import with preview, validation, and optional TestConnection integration
|
|
161
|
+
- ✅ **Table Component** - Complex table with search, export, pagination, sorting, and bulk actions (Redux optional)
|
|
162
|
+
- ✅ **All Chart Components** - 7 chart types with full dark mode support
|
|
163
|
+
- ✅ **All Context Providers** - Theme, Toast, Loader, and ContextProvider with optional Redux/Router
|
|
164
|
+
- ✅ **All Hooks** - 7 custom hooks with optional Redux integration
|
|
165
|
+
- ✅ **Dark Mode Support** - All components support dark mode via CSS variables
|
|
166
|
+
- ✅ **SSR/Next.js Compatibility** - FileBrowser and DbSchemaBrowser are SSR-safe with client-side library loading
|
|
167
|
+
- ✅ **Storybook Stories** - All migrated components have comprehensive Storybook stories
|
|
168
|
+
|
|
169
|
+
## Component Categories
|
|
170
|
+
|
|
171
|
+
### ✅ Basic UI Components (13/13 - 100%)
|
|
172
|
+
- **Alert** - Alert messages with variants (success, error, warning, info)
|
|
173
|
+
- **Loader** - Loading spinner component
|
|
174
|
+
- **Modal** - Modal dialog with header, body, and footer
|
|
175
|
+
- **Toast** - Toast notification component
|
|
176
|
+
- **ToolTip** - Tooltip component with positioning
|
|
177
|
+
- **StatusBadge** - Status badge with icons and animations
|
|
178
|
+
- **ToggleSwitch** - Toggle switch component
|
|
179
|
+
- **ResourceUsageBadge** - Resource usage indicator
|
|
180
|
+
- **ShowMultiData** - Expandable multi-line data display
|
|
181
|
+
- **RiskScoreLabel** - Risk score display with color coding
|
|
182
|
+
- **FileTypeIcon** - File type icon component
|
|
183
|
+
- **NoActiveAttributeWarning** - Warning message component
|
|
184
|
+
- **CountryBox** - Country selection/display box
|
|
185
|
+
|
|
186
|
+
### ✅ Form Components (4/4 - 100%)
|
|
187
|
+
- **Dropdown** - Dropdown menu using Headless UI
|
|
188
|
+
- **MultiSelect** - Multi-select component using react-select
|
|
189
|
+
- **Table** - Advanced table component with pagination, sorting, search, export, and bulk actions (Redux optional)
|
|
190
|
+
- **CSVImporter** - CSV import component with preview and validation
|
|
191
|
+
|
|
192
|
+
### ✅ Chart Components (7/7 - 100%)
|
|
193
|
+
- **DonutChart** - Doughnut chart with legends and optional table
|
|
194
|
+
- **PieChart** - Pie chart with percentage labels
|
|
195
|
+
- **VerticalBarChart** - Vertical bar chart with optional line overlay
|
|
196
|
+
- **HorizontalBarChart** - Horizontal bar chart with scale options (linear, logarithmic, normalized)
|
|
197
|
+
- **GaugeChart** - Gauge/donut chart with optional year range slider
|
|
198
|
+
- **GeoChart** - Geographic choropleth map chart
|
|
199
|
+
- **StorageChart** - Storage visualization with icon and formatted values
|
|
200
|
+
|
|
201
|
+
### ✅ Chart Helper Components (3/3 - 100%)
|
|
202
|
+
- **NoDataChart** - Empty state component for charts
|
|
203
|
+
- **ChartHeader** - Chart header with title and optional right content
|
|
204
|
+
- **CustomLegends** - Custom legend component for charts
|
|
205
|
+
|
|
206
|
+
### ✅ Utility Components (4/4 - 100%)
|
|
207
|
+
- **ConfirmationModal** - Confirmation dialog with customizable actions
|
|
208
|
+
- **Timer** - Countdown/elapsed time display
|
|
209
|
+
- **ErrorBoundary** - Top-level error boundary with fallback UI
|
|
210
|
+
- **ComponentErrorBoundary** - Component-level error boundary
|
|
211
|
+
|
|
212
|
+
### ✅ Specialized Components (6/6 - 100%)
|
|
213
|
+
- **TaskResult** - Task result modal with summary and error details
|
|
214
|
+
- **InstallUpdateLoader** - Installation/update progress loader
|
|
215
|
+
- **ConfidenceScoreTooltip** - Classification confidence score tooltip
|
|
216
|
+
- **ImagePreviewModal** - Image preview modal with loading and error handling
|
|
217
|
+
- **FileBrowser** - File browsing interface with tree view, search, pagination, and metadata display (uses jstree)
|
|
218
|
+
- **DbSchemaBrowser** - Database schema browser with interactive graph visualization (uses ReactFlow)
|
|
219
|
+
|
|
220
|
+
### ⏳ Remaining Components (9 components)
|
|
221
|
+
- **FilterModal** - Advanced filtering modal (in progress)
|
|
222
|
+
- **MixedScanResults** - Combined file and database scan results
|
|
223
|
+
- **NotificationQueue** - Toast notification queue
|
|
224
|
+
- **ProductSwitcher** - Product selection switcher
|
|
225
|
+
- **TestConnection** - Connection testing component
|
|
226
|
+
- **CustomRecurrenceDialog** - Recurrence pattern dialog
|
|
227
|
+
- **UpdateDepartmentModal** - Department update modal
|
|
228
|
+
- **UpdateSettings** - Settings update component
|
|
229
|
+
- **UserAppUpdateSettings** - User app update settings
|
|
230
|
+
|
|
231
|
+
## Hooks (7/7 - 100% Complete)
|
|
232
|
+
|
|
233
|
+
- ✅ **useApiCache** - API response caching hook with Redux integration (optional)
|
|
234
|
+
- ✅ **useAssetPath** / **useFileIconPath** - Asset path resolution hook (Electron-agnostic)
|
|
235
|
+
- ✅ **useBodyScrollLock** - Body scroll lock hook for modals
|
|
236
|
+
- ✅ **useClickOutside** - Click outside detection hook
|
|
237
|
+
- ✅ **useDebounce** - Debounce hook for input values
|
|
238
|
+
- ✅ **useFilterCache** - Filter state caching hook with Redux integration (optional)
|
|
239
|
+
- ✅ **useReduxHook** - Redux integration hook (useAppDispatch, useAppSelector) - gracefully handles missing Redux
|
|
240
|
+
|
|
241
|
+
## Utility Functions
|
|
242
|
+
|
|
243
|
+
### General Utilities
|
|
244
|
+
- **formatBytes** - Format bytes to human-readable size (KB, MB, GB, etc.)
|
|
245
|
+
- **cn** - Class name utility (similar to clsx)
|
|
246
|
+
- **conditionalClass** - Conditional class name utility
|
|
247
|
+
- **switchClass** - Switch-based class name utility
|
|
248
|
+
- **globalFiltersEqual** - Deep equality check for filter objects
|
|
249
|
+
- **deepEqual** - Deep equality comparison utility
|
|
250
|
+
|
|
251
|
+
### Status & Risk Utilities
|
|
252
|
+
- **getStatusConfig** - Get status configuration with icon and colors
|
|
253
|
+
- **isRunningStatus** - Check if status is running
|
|
254
|
+
- **isFailedStatus** - Check if status is failed
|
|
255
|
+
- **isSuccessStatus** - Check if status is successful
|
|
256
|
+
- **getRiskLevel** - Get risk level from score
|
|
257
|
+
- **getRiskScoreInfo** - Get risk score information with color and label
|
|
258
|
+
- **isHighRisk** - Check if risk score is high
|
|
259
|
+
|
|
260
|
+
### FileBrowser Utilities
|
|
261
|
+
- **convertScanObjectToFiledata** - Convert scan object to file metadata format
|
|
262
|
+
- **formatDateTime** - Format date/time to readable string
|
|
263
|
+
- **isChildPath** - Check if path is a child of another path
|
|
264
|
+
- **ucwords** - Capitalize first letter of each word
|
|
265
|
+
|
|
266
|
+
### DbSchemaBrowser Utilities
|
|
267
|
+
- **convertScanObjectToDbSchema** - Convert scan object to database schema format
|
|
268
|
+
- **extractAttributeMapping** - Extract attribute mappings from metadata
|
|
269
|
+
- **extractConfidenceMetadata** - Extract confidence metadata from scan objects
|
|
270
|
+
- **getConfidenceColor** - Get color class for confidence score
|
|
271
|
+
|
|
272
|
+
## Constants
|
|
273
|
+
|
|
274
|
+
- **FILE_BROWSER_PAGE_SIZE** - Default page size for file browser pagination (50)
|
|
275
|
+
- **NOT_APPLICABLE** - Constant for N/A values ('-')
|
|
276
|
+
- **METADATA_KEYS** - Metadata key constants (attribute_mapping, confidence_metadata)
|
|
277
|
+
- **PAGE_SIZE**, **PAGE_INDEX** - Table pagination constants
|
|
278
|
+
- **STATUS_BADGE_CLASSES** - Status badge CSS class mappings
|
|
279
|
+
|
|
280
|
+
## Context Providers (4/4 - 100% Complete)
|
|
281
|
+
|
|
282
|
+
- ✅ **ThemeProvider** - Theme management (light/dark mode) with CSS variables, custom fonts, and global styling
|
|
283
|
+
- ✅ **ToastProvider** - Toast notification management with optional Redux integration
|
|
284
|
+
- ✅ **LoaderProvider** - Global loading state management
|
|
285
|
+
- ✅ **ContextProvider** - Main context provider wrapper that aggregates all providers (Redux and Router optional)
|
|
286
|
+
|
|
287
|
+
## Development
|
|
288
|
+
|
|
289
|
+
### Prerequisites
|
|
290
|
+
|
|
291
|
+
- Node.js 18+
|
|
292
|
+
- npm, yarn, or pnpm
|
|
293
|
+
|
|
294
|
+
### Setup
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
# Clone the repository
|
|
298
|
+
git clone https://github.com/iqworksai/common-components.git
|
|
299
|
+
cd common-components
|
|
300
|
+
|
|
301
|
+
# Install dependencies
|
|
302
|
+
npm install
|
|
303
|
+
|
|
304
|
+
# Run Storybook
|
|
305
|
+
npm run storybook
|
|
306
|
+
|
|
307
|
+
# Build library
|
|
308
|
+
npm run build
|
|
309
|
+
|
|
310
|
+
# Run tests
|
|
311
|
+
npm test
|
|
312
|
+
|
|
313
|
+
# Run tests with coverage
|
|
314
|
+
npm run test:coverage
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Available Scripts
|
|
318
|
+
|
|
319
|
+
- `npm run build` - Build the library for production
|
|
320
|
+
- `npm run build:watch` - Build in watch mode
|
|
321
|
+
- `npm run typecheck` - Type check without emitting
|
|
322
|
+
- `npm test` - Run tests
|
|
323
|
+
- `npm run test:watch` - Run tests in watch mode
|
|
324
|
+
- `npm run test:coverage` - Run tests with coverage
|
|
325
|
+
- `npm run lint` - Lint code
|
|
326
|
+
- `npm run lint:fix` - Fix linting issues
|
|
327
|
+
- `npm run storybook` - Start Storybook dev server
|
|
328
|
+
- `npm run build-storybook` - Build Storybook for deployment
|
|
329
|
+
|
|
330
|
+
## Styling
|
|
331
|
+
|
|
332
|
+
This library uses Tailwind CSS with CSS variables for theming. To use the components in your project:
|
|
333
|
+
|
|
334
|
+
1. **Import the styles** in your app:
|
|
335
|
+
```tsx
|
|
336
|
+
import '@iqworksai/common-components/dist/style.css';
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
2. **Configure Tailwind** to include the library:
|
|
340
|
+
```js
|
|
341
|
+
// tailwind.config.js
|
|
342
|
+
module.exports = {
|
|
343
|
+
content: [
|
|
344
|
+
'./src/**/*.{js,jsx,ts,tsx}',
|
|
345
|
+
'./node_modules/@iqworksai/common-components/**/*.{js,jsx,ts,tsx}',
|
|
346
|
+
],
|
|
347
|
+
darkMode: 'class', // Required for dark mode support
|
|
348
|
+
// ... rest of config
|
|
349
|
+
};
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
3. **Wrap your app with ThemeProvider** for theme support:
|
|
353
|
+
```tsx
|
|
354
|
+
import { ThemeProvider } from '@iqworksai/common-components';
|
|
355
|
+
|
|
356
|
+
function App() {
|
|
357
|
+
return (
|
|
358
|
+
<ThemeProvider>
|
|
359
|
+
{/* Your app */}
|
|
360
|
+
</ThemeProvider>
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### CSS Variables
|
|
366
|
+
|
|
367
|
+
The library uses CSS variables for theming. Key variables include:
|
|
368
|
+
- `--bg-color` - Background color
|
|
369
|
+
- `--text-color` - Text color
|
|
370
|
+
- `--border-color` - Border color
|
|
371
|
+
- `--brand-primary` - Primary brand color (orange)
|
|
372
|
+
- `--brand-light` - Light brand color
|
|
373
|
+
- `--brand-dark` - Dark brand color
|
|
374
|
+
- `--hover-bg-color` - Hover background color
|
|
375
|
+
|
|
376
|
+
See `src/styles/index.css` for the complete list of CSS variables.
|
|
377
|
+
|
|
378
|
+
## TypeScript Support
|
|
379
|
+
|
|
380
|
+
Full TypeScript support is included. Import types as needed:
|
|
381
|
+
|
|
382
|
+
```tsx
|
|
383
|
+
import type {
|
|
384
|
+
AlertProps,
|
|
385
|
+
TableProps,
|
|
386
|
+
CSVRow,
|
|
387
|
+
PaginatedResult,
|
|
388
|
+
ListApiParameters,
|
|
389
|
+
FilterState,
|
|
390
|
+
FilterField
|
|
391
|
+
} from '@iqworksai/common-components';
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### Type Definitions
|
|
395
|
+
|
|
396
|
+
All components export their prop types. Key type exports include:
|
|
397
|
+
- Component prop types (e.g., `AlertProps`, `TableProps`, `ModalProps`, `FileBrowserProps`, `DBMetadataTableProps`)
|
|
398
|
+
- Table types (`PaginatedResult`, `ListApiParameters`, `FilterState`, `FilterField`)
|
|
399
|
+
- CSV types (`CSVRow`)
|
|
400
|
+
- Status types (`StatusConfig`, `RiskScoreInfo`)
|
|
401
|
+
- Context types (`ThemeConfig`, `ToastContextProps`, `LoaderContextProps`)
|
|
402
|
+
- FileBrowser types (`FileMetadata`, `ScanReport`, `FileBrowserApi`, `FileBrowserScanObject`)
|
|
403
|
+
- DbSchemaBrowser types (`Column`, `NodeData`, `SelectedTable`, `Attribute`, `CountryData`, `DbSchemaBrowserApi`, `DbSchemaScanObject`)
|
|
404
|
+
|
|
405
|
+
## Dependencies
|
|
406
|
+
|
|
407
|
+
### Core Dependencies
|
|
408
|
+
- **React 18+** - Required peer dependency
|
|
409
|
+
- **dayjs** - Date/time manipulation (replaces moment)
|
|
410
|
+
- **jquery** - Required for FileBrowser (loaded client-side only)
|
|
411
|
+
- **jstree** - Tree view component for FileBrowser (loaded client-side only)
|
|
412
|
+
- **reactflow** - Graph visualization for DbSchemaBrowser (loaded client-side only)
|
|
413
|
+
- **react-icons** - Icon library
|
|
414
|
+
- **react-select** - Select component
|
|
415
|
+
- **chart.js** - Chart components
|
|
416
|
+
- **@tanstack/react-table** - Table component
|
|
417
|
+
|
|
418
|
+
### Optional Dependencies
|
|
419
|
+
- **@reduxjs/toolkit** - Optional Redux integration
|
|
420
|
+
- **react-redux** - Optional Redux integration
|
|
421
|
+
- **react-router-dom** - Optional router integration
|
|
422
|
+
|
|
423
|
+
## Browser Support
|
|
424
|
+
|
|
425
|
+
- Chrome (latest)
|
|
426
|
+
- Firefox (latest)
|
|
427
|
+
- Safari (latest)
|
|
428
|
+
- Edge (latest)
|
|
429
|
+
- Next.js 13+ (SSR compatible)
|
|
430
|
+
|
|
431
|
+
## Contributing
|
|
432
|
+
|
|
433
|
+
Contributions are welcome! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
|
|
434
|
+
|
|
435
|
+
## Versioning
|
|
436
|
+
|
|
437
|
+
This project follows [Semantic Versioning](https://semver.org/):
|
|
438
|
+
- **MAJOR** version for breaking changes
|
|
439
|
+
- **MINOR** version for new features (backward compatible)
|
|
440
|
+
- **PATCH** version for bug fixes (backward compatible)
|
|
441
|
+
|
|
442
|
+
## License
|
|
443
|
+
|
|
444
|
+
PROPRIETARY - Internal use only
|
|
445
|
+
|
|
446
|
+
## Support
|
|
447
|
+
|
|
448
|
+
For issues and questions, please open an issue on [GitHub](https://github.com/iqworksai/common-components/issues).
|
|
449
|
+
|
|
450
|
+
## Changelog
|
|
451
|
+
|
|
452
|
+
See [CHANGELOG.md](./CHANGELOG.md) for a list of changes.
|
|
453
|
+
|
|
454
|
+
## Key Features & Highlights
|
|
455
|
+
|
|
456
|
+
### 🎯 Optional Dependencies
|
|
457
|
+
- **Redux** - All Redux dependencies are optional. Components work without Redux, but can integrate if available.
|
|
458
|
+
- **React Router** - Router is optional in ContextProvider.
|
|
459
|
+
- **Electron** - All Electron-specific code has been removed or made optional.
|
|
460
|
+
|
|
461
|
+
### ⚡ SSR & Next.js Compatibility
|
|
462
|
+
- **FileBrowser** - Uses dynamic imports for jQuery and jstree (client-side only), fully SSR-safe
|
|
463
|
+
- **DbSchemaBrowser** - Uses dynamic imports for ReactFlow (client-side only), fully SSR-safe
|
|
464
|
+
- **Date Handling** - Uses dayjs instead of moment for better bundle size and SSR compatibility
|
|
465
|
+
- All components work seamlessly with Next.js server-side rendering
|
|
466
|
+
|
|
467
|
+
### 🌓 Dark Mode
|
|
468
|
+
- All components support dark mode via CSS variables.
|
|
469
|
+
- ThemeProvider manages theme state and CSS variables.
|
|
470
|
+
- Seamless theme switching with `toggleTheme()`.
|
|
471
|
+
|
|
472
|
+
### 📊 Advanced Table Component
|
|
473
|
+
- Pagination, sorting, searching, and filtering
|
|
474
|
+
- Bulk actions support
|
|
475
|
+
- Export to CSV functionality
|
|
476
|
+
- Optional Redux integration
|
|
477
|
+
- Optional FilterModal integration
|
|
478
|
+
- Row click handlers
|
|
479
|
+
- Column borders and styling options
|
|
480
|
+
|
|
481
|
+
### 📈 Chart Components
|
|
482
|
+
- 7 chart types using Chart.js
|
|
483
|
+
- Full dark mode support
|
|
484
|
+
- Custom legends and headers
|
|
485
|
+
- Empty state handling
|
|
486
|
+
- Responsive and accessible
|
|
487
|
+
|
|
488
|
+
### 🎨 Theming
|
|
489
|
+
- CSS variable-based theming
|
|
490
|
+
- Custom font support
|
|
491
|
+
- Global style overrides
|
|
492
|
+
- Consistent color palette
|
|
493
|
+
|
|
494
|
+
## Migration Status
|
|
495
|
+
|
|
496
|
+
**37 out of 46 components completed (80%)**
|
|
497
|
+
|
|
498
|
+
- ✅ All basic UI components
|
|
499
|
+
- ✅ All chart components
|
|
500
|
+
- ✅ All context providers
|
|
501
|
+
- ✅ All hooks
|
|
502
|
+
- ✅ All form components (including complex Table)
|
|
503
|
+
- ✅ All utility components
|
|
504
|
+
- ✅ FileBrowser and DbSchemaBrowser (SSR-safe, Next.js compatible)
|
|
505
|
+
- ⏳ FilterModal (in progress)
|
|
506
|
+
- ⏳ 8 remaining specialized components
|
|
507
|
+
|
|
508
|
+
See [NEXT_STEPS.md](./NEXT_STEPS.md) for detailed progress and roadmap.
|
|
509
|
+
|
|
510
|
+
---
|
|
511
|
+
|
|
512
|
+
Built with ❤️ by the IQWorks team
|
|
513
|
+
|