@iqworksai/common-components 0.1.7 → 0.1.9

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 CHANGED
@@ -1,398 +1,513 @@
1
- # @iqworksai/common-components
2
-
3
- A reusable React component library and utilities package for IQWorks applications. Provides 46+ UI components, custom hooks, context providers, and utility functions extracted from DiscoverIQ Desktop.
4
-
5
- ## 🎉 Current Status
6
-
7
- **Progress: 35 out of 46 components migrated (76%)**
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**: 4/4 (100%) - TaskResult, InstallUpdateLoader, ConfidenceScoreTooltip, ImagePreviewModal
18
-
19
- ### ⏳ In Progress
20
- - 🔄 **FilterModal** - Advanced filtering modal (next priority)
21
- - 📋 **Remaining Components**: 11 components remaining (FileBrowser, DbSchemaBrowser, MixedScanResults, etc.)
22
-
23
- ## Features
24
-
25
- - 🎨 **35+ UI Components** - Comprehensive set of React components including modals, charts, forms, 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, 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
- ## Installation
38
-
39
- ```bash
40
- npm install @iqworksai/common-components
41
- # or
42
- yarn add @iqworksai/common-components
43
- # or
44
- pnpm add @iqworksai/common-components
45
- ```
46
-
47
- ## Quick Start
48
-
49
- ### Basic Setup
50
-
51
- ```tsx
52
- import { ThemeProvider, ToastProvider } from '@iqworksai/common-components';
53
-
54
- function App() {
55
- return (
56
- <ThemeProvider>
57
- <ToastProvider>
58
- {/* Your app content */}
59
- </ToastProvider>
60
- </ThemeProvider>
61
- );
62
- }
63
- ```
64
-
65
- ### Using Components
66
-
67
- ```tsx
68
- import { Alert, Modal, Loader, Table } from '@iqworksai/common-components';
69
-
70
- function MyComponent() {
71
- return (
72
- <div>
73
- <Alert message="Welcome!" type="success" />
74
- <Loader loading={true} />
75
- <Table data={myData} columns={myColumns} />
76
- </div>
77
- );
78
- }
79
- ```
80
-
81
- ### Using Hooks
82
-
83
- ```tsx
84
- import { useDebounce, useClickOutside } from '@iqworksai/common-components';
85
-
86
- function SearchComponent() {
87
- const [searchTerm, setSearchTerm] = useState('');
88
- const debouncedSearch = useDebounce(searchTerm, 500);
89
-
90
- // Use debouncedSearch for API calls
91
- }
92
- ```
93
-
94
- ### Using Utilities
95
-
96
- ```tsx
97
- import { formatBytes, getStatusConfig, getRiskScoreInfo } from '@iqworksai/common-components';
98
-
99
- const size = formatBytes(1024); // "1 KB"
100
- const status = getStatusConfig('successful'); // Status configuration with icon and colors
101
- const riskInfo = getRiskScoreInfo(75); // Risk level information
102
- ```
103
-
104
- ## Documentation
105
-
106
- - **Storybook Documentation** - Run `npm run storybook` to view interactive component playground with live examples
107
- - **[Next Steps](./NEXT_STEPS.md)** - Detailed migration progress and roadmap
108
- - **[Component Migration Guide](./COMPONENT_MIGRATION_GUIDE.md)** - Guidelines for migrating components
109
- - **[Setup Progress](./SETUP_PROGRESS.md)** - Setup and configuration progress
110
-
111
- ### Recent Accomplishments
112
-
113
- - ✅ **CSVImporter Component** - CSV import with preview, validation, and optional TestConnection integration
114
- - **Table Component** - Complex table with search, export, pagination, sorting, and bulk actions (Redux optional)
115
- - ✅ **All Chart Components** - 7 chart types with full dark mode support
116
- - ✅ **All Context Providers** - Theme, Toast, Loader, and ContextProvider with optional Redux/Router
117
- - **All Hooks** - 7 custom hooks with optional Redux integration
118
- - ✅ **Dark Mode Support** - All components support dark mode via CSS variables
119
- - **Storybook Stories** - All migrated components have comprehensive Storybook stories
120
-
121
- ## Component Categories
122
-
123
- ### Basic UI Components (13/13 - 100%)
124
- - **Alert** - Alert messages with variants (success, error, warning, info)
125
- - **Loader** - Loading spinner component
126
- - **Modal** - Modal dialog with header, body, and footer
127
- - **Toast** - Toast notification component
128
- - **ToolTip** - Tooltip component with positioning
129
- - **StatusBadge** - Status badge with icons and animations
130
- - **ToggleSwitch** - Toggle switch component
131
- - **ResourceUsageBadge** - Resource usage indicator
132
- - **ShowMultiData** - Expandable multi-line data display
133
- - **RiskScoreLabel** - Risk score display with color coding
134
- - **FileTypeIcon** - File type icon component
135
- - **NoActiveAttributeWarning** - Warning message component
136
- - **CountryBox** - Country selection/display box
137
-
138
- ### Form Components (4/4 - 100%)
139
- - **Dropdown** - Dropdown menu using Headless UI
140
- - **MultiSelect** - Multi-select component using react-select
141
- - **Table** - Advanced table component with pagination, sorting, search, export, and bulk actions (Redux optional)
142
- - **CSVImporter** - CSV import component with preview and validation
143
-
144
- ### ✅ Chart Components (7/7 - 100%)
145
- - **DonutChart** - Doughnut chart with legends and optional table
146
- - **PieChart** - Pie chart with percentage labels
147
- - **VerticalBarChart** - Vertical bar chart with optional line overlay
148
- - **HorizontalBarChart** - Horizontal bar chart with scale options (linear, logarithmic, normalized)
149
- - **GaugeChart** - Gauge/donut chart with optional year range slider
150
- - **GeoChart** - Geographic choropleth map chart
151
- - **StorageChart** - Storage visualization with icon and formatted values
152
-
153
- ### Chart Helper Components (3/3 - 100%)
154
- - **NoDataChart** - Empty state component for charts
155
- - **ChartHeader** - Chart header with title and optional right content
156
- - **CustomLegends** - Custom legend component for charts
157
-
158
- ###Utility Components (4/4 - 100%)
159
- - **ConfirmationModal** - Confirmation dialog with customizable actions
160
- - **Timer** - Countdown/elapsed time display
161
- - **ErrorBoundary** - Top-level error boundary with fallback UI
162
- - **ComponentErrorBoundary** - Component-level error boundary
163
-
164
- ###Specialized Components (4/4 - 100%)
165
- - **TaskResult** - Task result modal with summary and error details
166
- - **InstallUpdateLoader** - Installation/update progress loader
167
- - **ConfidenceScoreTooltip** - Classification confidence score tooltip
168
- - **ImagePreviewModal** - Image preview modal with loading and error handling
169
-
170
- ### ⏳ Remaining Components (11 components)
171
- - **FilterModal** - Advanced filtering modal (in progress)
172
- - **FileBrowser** - File browsing interface
173
- - **DbSchemaBrowser** - Database schema browser
174
- - **MixedScanResults** - Combined file and database scan results
175
- - **NotificationQueue** - Toast notification queue
176
- - **ProductSwitcher** - Product selection switcher
177
- - **TestConnection** - Connection testing component
178
- - **CustomRecurrenceDialog** - Recurrence pattern dialog
179
- - **UpdateDepartmentModal** - Department update modal
180
- - **UpdateSettings** - Settings update component
181
- - **UserAppUpdateSettings** - User app update settings
182
-
183
- ## Hooks (7/7 - 100% Complete)
184
-
185
- - ✅ **useApiCache** - API response caching hook with Redux integration (optional)
186
- -**useAssetPath** / **useFileIconPath** - Asset path resolution hook (Electron-agnostic)
187
- - **useBodyScrollLock** - Body scroll lock hook for modals
188
- - **useClickOutside** - Click outside detection hook
189
- - **useDebounce** - Debounce hook for input values
190
- - **useFilterCache** - Filter state caching hook with Redux integration (optional)
191
- - ✅ **useReduxHook** - Redux integration hook (useAppDispatch, useAppSelector) - gracefully handles missing Redux
192
-
193
- ## Context Providers (4/4 - 100% Complete)
194
-
195
- - **ThemeProvider** - Theme management (light/dark mode) with CSS variables, custom fonts, and global styling
196
- - **ToastProvider** - Toast notification management with optional Redux integration
197
- - **LoaderProvider** - Global loading state management
198
- - **ContextProvider** - Main context provider wrapper that aggregates all providers (Redux and Router optional)
199
-
200
- ## Development
201
-
202
- ### Prerequisites
203
-
204
- - Node.js 18+
205
- - npm, yarn, or pnpm
206
-
207
- ### Setup
208
-
209
- ```bash
210
- # Clone the repository
211
- git clone https://github.com/iqworksai/common-components.git
212
- cd common-components
213
-
214
- # Install dependencies
215
- npm install
216
-
217
- # Run Storybook
218
- npm run storybook
219
-
220
- # Build library
221
- npm run build
222
-
223
- # Run tests
224
- npm test
225
-
226
- # Run tests with coverage
227
- npm run test:coverage
228
- ```
229
-
230
- ### Available Scripts
231
-
232
- - `npm run build` - Build the library for production
233
- - `npm run build:watch` - Build in watch mode
234
- - `npm run typecheck` - Type check without emitting
235
- - `npm test` - Run tests
236
- - `npm run test:watch` - Run tests in watch mode
237
- - `npm run test:coverage` - Run tests with coverage
238
- - `npm run lint` - Lint code
239
- - `npm run lint:fix` - Fix linting issues
240
- - `npm run storybook` - Start Storybook dev server
241
- - `npm run build-storybook` - Build Storybook for deployment
242
-
243
- ## Styling
244
-
245
- This library uses Tailwind CSS with CSS variables for theming. To use the components in your project:
246
-
247
- 1. **Import the styles** in your app:
248
- ```tsx
249
- import '@iqworksai/common-components/dist/style.css';
250
- ```
251
-
252
- 2. **Configure Tailwind** to include the library:
253
- ```js
254
- // tailwind.config.js
255
- module.exports = {
256
- content: [
257
- './src/**/*.{js,jsx,ts,tsx}',
258
- './node_modules/@iqworksai/common-components/**/*.{js,jsx,ts,tsx}',
259
- ],
260
- darkMode: 'class', // Required for dark mode support
261
- // ... rest of config
262
- };
263
- ```
264
-
265
- 3. **Wrap your app with ThemeProvider** for theme support:
266
- ```tsx
267
- import { ThemeProvider } from '@iqworksai/common-components';
268
-
269
- function App() {
270
- return (
271
- <ThemeProvider>
272
- {/* Your app */}
273
- </ThemeProvider>
274
- );
275
- }
276
- ```
277
-
278
- ### CSS Variables
279
-
280
- The library uses CSS variables for theming. Key variables include:
281
- - `--bg-color` - Background color
282
- - `--text-color` - Text color
283
- - `--border-color` - Border color
284
- - `--brand-primary` - Primary brand color (orange)
285
- - `--brand-light` - Light brand color
286
- - `--brand-dark` - Dark brand color
287
- - `--hover-bg-color` - Hover background color
288
-
289
- See `src/styles/index.css` for the complete list of CSS variables.
290
-
291
- ## TypeScript Support
292
-
293
- Full TypeScript support is included. Import types as needed:
294
-
295
- ```tsx
296
- import type {
297
- AlertProps,
298
- TableProps,
299
- CSVRow,
300
- PaginatedResult,
301
- ListApiParameters,
302
- FilterState,
303
- FilterField
304
- } from '@iqworksai/common-components';
305
- ```
306
-
307
- ### Type Definitions
308
-
309
- All components export their prop types. Key type exports include:
310
- - Component prop types (e.g., `AlertProps`, `TableProps`, `ModalProps`)
311
- - Table types (`PaginatedResult`, `ListApiParameters`, `FilterState`, `FilterField`)
312
- - CSV types (`CSVRow`)
313
- - Status types (`StatusConfig`, `RiskScoreInfo`)
314
- - Context types (`ThemeConfig`, `ToastContextProps`, `LoaderContextProps`)
315
-
316
- ## Browser Support
317
-
318
- - Chrome (latest)
319
- - Firefox (latest)
320
- - Safari (latest)
321
- - Edge (latest)
322
-
323
- ## Contributing
324
-
325
- Contributions are welcome! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
326
-
327
- ## Versioning
328
-
329
- This project follows [Semantic Versioning](https://semver.org/):
330
- - **MAJOR** version for breaking changes
331
- - **MINOR** version for new features (backward compatible)
332
- - **PATCH** version for bug fixes (backward compatible)
333
-
334
- ## License
335
-
336
- PROPRIETARY - Internal use only
337
-
338
- ## Support
339
-
340
- For issues and questions, please open an issue on [GitHub](https://github.com/iqworksai/common-components/issues).
341
-
342
- ## Changelog
343
-
344
- See [CHANGELOG.md](./CHANGELOG.md) for a list of changes.
345
-
346
- ## Key Features & Highlights
347
-
348
- ### 🎯 Optional Dependencies
349
- - **Redux** - All Redux dependencies are optional. Components work without Redux, but can integrate if available.
350
- - **React Router** - Router is optional in ContextProvider.
351
- - **Electron** - All Electron-specific code has been removed or made optional.
352
-
353
- ### 🌓 Dark Mode
354
- - All components support dark mode via CSS variables.
355
- - ThemeProvider manages theme state and CSS variables.
356
- - Seamless theme switching with `toggleTheme()`.
357
-
358
- ### 📊 Advanced Table Component
359
- - Pagination, sorting, searching, and filtering
360
- - Bulk actions support
361
- - Export to CSV functionality
362
- - Optional Redux integration
363
- - Optional FilterModal integration
364
- - Row click handlers
365
- - Column borders and styling options
366
-
367
- ### 📈 Chart Components
368
- - 7 chart types using Chart.js
369
- - Full dark mode support
370
- - Custom legends and headers
371
- - Empty state handling
372
- - Responsive and accessible
373
-
374
- ### 🎨 Theming
375
- - CSS variable-based theming
376
- - Custom font support
377
- - Global style overrides
378
- - Consistent color palette
379
-
380
- ## Migration Status
381
-
382
- **35 out of 46 components completed (76%)**
383
-
384
- - ✅ All basic UI components
385
- - ✅ All chart components
386
- - ✅ All context providers
387
- - ✅ All hooks
388
- - ✅ All form components (including complex Table)
389
- - ✅ All utility components
390
- - ⏳ FilterModal (in progress)
391
- - 10 remaining specialized components
392
-
393
- See [NEXT_STEPS.md](./NEXT_STEPS.md) for detailed progress and roadmap.
394
-
395
- ---
396
-
397
- Built with ❤️ by the IQWorks team
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
+