@digilogiclabs/saas-factory-ui 0.11.0 → 0.13.0

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,6 +1,6 @@
1
1
  # @digilogiclabs/saas-factory-ui
2
2
 
3
- A comprehensive cross-platform UI component library built for both **Next.js web applications** and **React Native/Expo mobile applications**. This package provides a complete set of accessible, customizable components with consistent design across platforms.
3
+ A comprehensive cross-platform UI component library built for both **Next.js web applications** and **React Native/Expo mobile applications**. This package provides a complete set of accessible, mobile-optimized components with consistent design across platforms.
4
4
 
5
5
  ## 🌟 Features
6
6
 
@@ -9,22 +9,31 @@ A comprehensive cross-platform UI component library built for both **Next.js web
9
9
  - Platform-optimized implementations
10
10
  - Shared design tokens and theming
11
11
  - 🌐 **Web Support**
12
- - Built with React, Tailwind CSS, and Radix UI
12
+ - Built with React, Tailwind CSS, Radix UI, and Framer Motion
13
13
  - Dark mode support
14
14
  - Responsive by default
15
15
  - 📱 **React Native Support**
16
- - Native mobile components
17
- - Expo compatibility
16
+ - Native mobile components with Expo compatibility
18
17
  - Platform-specific optimizations
18
+ - Haptic feedback integration
19
19
  - ♿️ **Accessibility First**
20
- - WCAG compliant components
20
+ - WCAG 2.2 AA compliant components
21
21
  - Screen reader support
22
- - Keyboard navigation
22
+ - Keyboard navigation and touch alternatives
23
+ - ⚡ **Performance Optimized**
24
+ - Advanced mobile interactions with gesture recognition
25
+ - Lazy loading and progressive image optimization
26
+ - Virtual scrolling for large datasets
27
+ - Network-aware content delivery
28
+ - 🌐 **Offline Support**
29
+ - Comprehensive caching strategies
30
+ - Offline-first component architecture
31
+ - Network detection and graceful degradation
23
32
  - 🎯 **Developer Experience**
24
- - TypeScript support
33
+ - Full TypeScript support
25
34
  - Tree-shakeable exports
26
35
  - Comprehensive documentation
27
- - Small bundle size
36
+ - Optimized bundle sizes
28
37
 
29
38
  ## 📦 Installation
30
39
 
@@ -36,8 +45,8 @@ npm install @digilogiclabs/saas-factory-ui
36
45
 
37
46
  ### Web Applications
38
47
  - Node.js >=20.0.0
39
- - Next.js 13+ or React 19+
40
- - Tailwind CSS 3.0 or higher
48
+ - Next.js 15+ or React 19+
49
+ - Tailwind CSS 3.4 or higher
41
50
  - TypeScript (recommended)
42
51
 
43
52
  ### React Native Applications
@@ -92,20 +101,34 @@ import './globals.css'; // Your app styles
92
101
  ### 4. Use Components
93
102
 
94
103
  ```tsx
95
- import { Button, Card, Container } from '@digilogiclabs/saas-factory-ui';
96
- // Web-specific import (alternative):
97
- // import { Button, Card, Container } from '@digilogiclabs/saas-factory-ui/web';
104
+ import {
105
+ Button,
106
+ Card,
107
+ Container,
108
+ PageTransition,
109
+ SwipeableCard,
110
+ LazyImage
111
+ } from '@digilogiclabs/saas-factory-ui';
98
112
 
99
113
  export default function HomePage() {
100
114
  return (
101
- <Container>
102
- <Card className="p-6">
103
- <h1 className="text-2xl font-bold mb-4">Welcome to Web</h1>
104
- <Button variant="default" size="lg">
105
- Get Started
106
- </Button>
107
- </Card>
108
- </Container>
115
+ <PageTransition type="slide" direction="horizontal">
116
+ <Container>
117
+ <Card className="p-6">
118
+ <h1 className="text-2xl font-bold mb-4">Welcome to Web</h1>
119
+ <LazyImage
120
+ src="/hero-image.jpg"
121
+ alt="Hero image"
122
+ className="w-full h-64 object-cover rounded-lg mb-4"
123
+ placeholder="blur"
124
+ webpSupport={true}
125
+ />
126
+ <Button variant="default" size="lg">
127
+ Get Started
128
+ </Button>
129
+ </Card>
130
+ </Container>
131
+ </PageTransition>
109
132
  );
110
133
  }
111
134
  ```
@@ -116,6 +139,10 @@ export default function HomePage() {
116
139
 
117
140
  ```bash
118
141
  npm install @digilogiclabs/saas-factory-ui
142
+ # Required for advanced features
143
+ npm install @react-native-community/netinfo
144
+ npm install @react-native-async-storage/async-storage
145
+ npm install expo-haptics
119
146
  ```
120
147
 
121
148
  ### 2. Import Native Components
@@ -124,85 +151,64 @@ npm install @digilogiclabs/saas-factory-ui
124
151
  import {
125
152
  NativeButton,
126
153
  NativeContainer,
127
- NativeCard
154
+ NativeCard,
155
+ NativePageTransition,
156
+ NativeSwipeableCard,
157
+ NativeLazyImage
128
158
  } from '@digilogiclabs/saas-factory-ui/native';
159
+ import { Text } from 'react-native';
129
160
 
130
161
  export default function App() {
131
162
  return (
132
- <NativeContainer style={{ flex: 1, padding: 20 }}>
133
- <NativeCard style={{ padding: 20 }}>
134
- <Text style={{ fontSize: 20, fontWeight: 'bold', marginBottom: 16 }}>
135
- Welcome to Mobile
136
- </Text>
137
- <NativeButton
138
- variant="default"
139
- size="lg"
140
- onPress={() => console.log('Pressed')}
141
- >
142
- Get Started
143
- </NativeButton>
144
- </NativeCard>
145
- </NativeContainer>
163
+ <NativePageTransition type="slide" direction="horizontal">
164
+ <NativeContainer style={{ flex: 1, padding: 20 }}>
165
+ <NativeCard style={{ padding: 20 }}>
166
+ <Text style={{ fontSize: 20, fontWeight: 'bold', marginBottom: 16 }}>
167
+ Welcome to Mobile
168
+ </Text>
169
+ <NativeLazyImage
170
+ source={{ uri: 'https://example.com/image.jpg' }}
171
+ style={{ width: '100%', height: 200, borderRadius: 8, marginBottom: 16 }}
172
+ placeholder="skeleton"
173
+ />
174
+ <NativeButton
175
+ variant="default"
176
+ size="lg"
177
+ onPress={() => console.log('Pressed')}
178
+ >
179
+ Get Started
180
+ </NativeButton>
181
+ </NativeCard>
182
+ </NativeContainer>
183
+ </NativePageTransition>
146
184
  );
147
185
  }
148
186
  ```
149
187
 
150
- ## 🎨 Theming & Styling
151
-
152
- ### Web Theming with CSS Variables
153
-
154
- The library supports CSS custom properties for consistent theming:
155
-
156
- ```css
157
- /* globals.css */
158
- :root {
159
- --primary: 220 14% 9%;
160
- --primary-foreground: 0 0% 98%;
161
- --secondary: 220 14% 96%;
162
- --secondary-foreground: 220 9% 46%;
163
- --muted: 220 14% 96%;
164
- --muted-foreground: 220 9% 46%;
165
- --accent: 220 14% 96%;
166
- --accent-foreground: 220 9% 46%;
167
- --destructive: 0 84% 60%;
168
- --destructive-foreground: 0 0% 98%;
169
- --border: 220 13% 91%;
170
- --input: 220 13% 91%;
171
- --ring: 220 14% 9%;
172
- --radius: 0.5rem;
173
- }
174
- ```
175
-
176
- ### Custom Styling
177
-
178
- #### Web (Tailwind CSS)
179
- ```tsx
180
- <Button className="bg-purple-500 hover:bg-purple-600 text-white">
181
- Custom Web Button
182
- </Button>
183
- ```
184
-
185
- #### React Native (StyleSheet)
186
- ```tsx
187
- <Button
188
- style={{ backgroundColor: '#8B5CF6' }}
189
- textStyle={{ color: 'white' }}
190
- >
191
- Custom Native Button
192
- </Button>
193
- ```
194
-
195
188
  ## 📚 Available Components
196
189
 
197
- ### ✅ Current Components (v0.7.2)
190
+ ### ✅ Core Components (v0.13.0)
198
191
 
199
192
  | Component | Web | Native | Description |
200
193
  |-----------|-----|--------|-------------|
201
- | `Button` | | | Primary action buttons with variants |
202
- | `Card` | ✅ | ✅ | Content containers with elevation |
194
+ | **Layout & Structure** | | | |
203
195
  | `Container` | ✅ | ✅ | Responsive layout containers |
204
196
  | `Grid` | ✅ | ✅ | Flexible grid layouts |
205
197
  | `Section` | ✅ | ✅ | Semantic page sections |
198
+ | `Card` | ✅ | ✅ | Content containers with elevation |
199
+ | **Interactive Elements** | | | |
200
+ | `Button` | ✅ | ✅ | Primary action buttons with variants |
201
+ | `SwipeableCard` | ✅ | ✅ | **NEW** Touch-friendly swipe gestures with haptic feedback |
202
+ | **Advanced Mobile Interactions** | | | |
203
+ | `PageTransition` | ✅ | ✅ | **NEW** Smooth page transitions with multiple animation types |
204
+ | `PullToRefresh` | ✅ | ✅ | **NEW** Native pull-to-refresh functionality |
205
+ | **Performance & Media** | | | |
206
+ | `LazyImage` | ✅ | ✅ | **NEW** Intelligent lazy loading with WebP support |
207
+ | `ProgressiveImage` | ✅ | ✅ | **NEW** Quality-aware progressive image loading |
208
+ | `VirtualScrollList` | ✅ | ✅ | **NEW** Memory-efficient virtual scrolling |
209
+ | **Network & Offline** | | | |
210
+ | `NetworkAwareContent` | ✅ | ✅ | **NEW** Smart content delivery based on network conditions |
211
+ | `OfflineWrapper` | ✅ | ✅ | **NEW** Comprehensive offline support with caching |
206
212
 
207
213
  ### 🌐 Web-Specific Components
208
214
 
@@ -224,6 +230,11 @@ The library supports CSS custom properties for consistent theming:
224
230
  - `Tabs` - Tabbed content navigation
225
231
  - `Toast` - Notification messages
226
232
  - `Tooltip` - Contextual help and information
233
+ - `AudioPlayer` - Advanced audio playback with playlists
234
+ - `VideoPlayer` - Feature-rich video player
235
+ - `AudioUploader` - Audio file upload with preview
236
+ - `FileUpload` - Drag-and-drop file uploads
237
+ - `Waveform` - Audio waveform visualization
227
238
 
228
239
  ### 📱 Native-Specific Components
229
240
 
@@ -234,6 +245,9 @@ The library supports CSS custom properties for consistent theming:
234
245
 
235
246
  #### Cross-Platform Hooks
236
247
  - `useMounted` - Component mount status detection
248
+ - `useNetworkInfo` - **NEW** Network connection monitoring
249
+ - `useOfflineState` - **NEW** Online/offline status detection
250
+ - `useCache` - **NEW** Persistent caching utilities
237
251
 
238
252
  #### Web-Only Hooks
239
253
  - `useMediaQuery` - Responsive breakpoint detection
@@ -243,384 +257,399 @@ The library supports CSS custom properties for consistent theming:
243
257
  - `useDimensions` - Screen dimensions and orientation
244
258
  - `useKeyboard` - Keyboard visibility and height
245
259
 
246
- ## 🛠 Advanced Usage
260
+ ## 🚀 New v0.13.0 Features
247
261
 
248
- ### Platform Detection
262
+ ### Advanced Mobile Interactions
249
263
 
250
- ```tsx
251
- import {
252
- Button as WebButton,
253
- Card as WebCard
254
- } from '@digilogiclabs/saas-factory-ui/web';
264
+ #### PageTransition
265
+ Smooth, customizable page transitions with multiple animation types:
255
266
 
256
- import {
257
- Button as NativeButton,
258
- Card as NativeCard
259
- } from '@digilogiclabs/saas-factory-ui/native';
267
+ ```tsx
268
+ // Web
269
+ import { PageTransition } from '@digilogiclabs/saas-factory-ui';
270
+
271
+ <PageTransition
272
+ type="slide"
273
+ direction="horizontal"
274
+ duration={300}
275
+ key={pageKey}
276
+ >
277
+ <YourPageContent />
278
+ </PageTransition>
260
279
 
261
- // Or use platform-specific imports in your bundler
280
+ // Supported types: 'slide', 'fade', 'scale', 'flip', 'elastic'
281
+ // Directions: 'horizontal', 'vertical', 'up', 'down', 'left', 'right'
262
282
  ```
263
283
 
264
- ### Component Composition
284
+ #### SwipeableCard
285
+ Touch-friendly cards with swipe actions and haptic feedback:
265
286
 
266
287
  ```tsx
267
- // Web example
268
- import { Button, Card, Badge } from '@digilogiclabs/saas-factory-ui';
269
-
270
- function UserCard({ user, isOnline }) {
271
- return (
272
- <Card className="p-4">
273
- <div className="flex items-center justify-between">
274
- <h3 className="font-semibold">{user.name}</h3>
275
- <Badge variant={isOnline ? "default" : "secondary"}>
276
- {isOnline ? "Online" : "Offline"}
277
- </Badge>
278
- </div>
279
- <Button className="mt-4" size="sm">
280
- View Profile
281
- </Button>
282
- </Card>
283
- );
284
- }
288
+ // Web
289
+ import { SwipeableCard } from '@digilogiclabs/saas-factory-ui';
290
+
291
+ <SwipeableCard
292
+ leftActions={[{
293
+ id: 'archive',
294
+ label: 'Archive',
295
+ backgroundColor: '#10B981',
296
+ onAction: () => archiveItem()
297
+ }]}
298
+ rightActions={[{
299
+ id: 'delete',
300
+ label: 'Delete',
301
+ backgroundColor: '#EF4444',
302
+ onAction: () => deleteItem()
303
+ }]}
304
+ hapticFeedback={true}
305
+ threshold={80}
306
+ >
307
+ <div className="p-4">
308
+ <h3>Swipe me left or right!</h3>
309
+ </div>
310
+ </SwipeableCard>
285
311
  ```
286
312
 
287
- ## 🚨 Common Issues & Solutions
288
-
289
- ### CSS Not Loading (Web)
290
-
291
- **Problem**: Components render but have no styling
292
-
293
- **Solution**: Ensure you've imported the CSS file:
313
+ #### PullToRefresh
314
+ Native pull-to-refresh functionality:
294
315
 
295
316
  ```tsx
296
- // In your root layout or _app.tsx
297
- import '@digilogiclabs/saas-factory-ui/styles.css';
317
+ // Web
318
+ import { PullToRefresh } from '@digilogiclabs/saas-factory-ui';
319
+
320
+ <PullToRefresh
321
+ onRefresh={async () => {
322
+ await fetchFreshData();
323
+ }}
324
+ threshold={60}
325
+ hapticFeedback={true}
326
+ >
327
+ <YourScrollableContent />
328
+ </PullToRefresh>
298
329
  ```
299
330
 
300
- ### Tailwind Classes Not Working
331
+ ### Performance Optimization
301
332
 
302
- **Problem**: Custom Tailwind classes not applying
333
+ #### LazyImage
334
+ Intelligent lazy loading with modern format support:
303
335
 
304
- **Solution**: Update your `tailwind.config.js` content array:
305
-
306
- ```js
307
- module.exports = {
308
- content: [
309
- // ... your paths
310
- "./node_modules/@digilogiclabs/saas-factory-ui/**/*.{js,ts,jsx,tsx}",
311
- ],
312
- // ...
313
- }
336
+ ```tsx
337
+ // Web
338
+ import { LazyImage } from '@digilogiclabs/saas-factory-ui';
339
+
340
+ <LazyImage
341
+ src="/large-image.jpg"
342
+ alt="Description"
343
+ placeholder="blur"
344
+ webpSupport={true}
345
+ mobileOptimization={{
346
+ quality: 75,
347
+ format: "webp",
348
+ sizes: "(max-width: 768px) 100vw, 50vw"
349
+ }}
350
+ loading="lazy"
351
+ fetchPriority="high"
352
+ retryAttempts={3}
353
+ />
314
354
  ```
315
355
 
316
- ### TypeScript Errors
317
-
318
- **Problem**: Import or type errors
319
-
320
- **Solution**: Try different import patterns:
356
+ #### ProgressiveImage
357
+ Quality-aware progressive loading:
321
358
 
322
359
  ```tsx
323
- // Method 1: Default import
324
- import { Button } from '@digilogiclabs/saas-factory-ui';
325
-
326
- // Method 2: Platform-specific import
327
- import { Button } from '@digilogiclabs/saas-factory-ui/web';
328
- import { Button } from '@digilogiclabs/saas-factory-ui/native';
360
+ // Web
361
+ import { ProgressiveImage } from '@digilogiclabs/saas-factory-ui';
362
+
363
+ <ProgressiveImage
364
+ lowQualitySrc="/thumbnail.jpg"
365
+ highQualitySrc="/full-quality.jpg"
366
+ alt="Progressive image"
367
+ mobileStrategy="blur-up"
368
+ transition="fade"
369
+ networkAware={true}
370
+ />
329
371
  ```
330
372
 
331
- ## 📖 Migration Guide
373
+ #### VirtualScrollList
374
+ Memory-efficient virtual scrolling for large datasets:
332
375
 
333
- ### From v0.6.x to v0.7.x
334
-
335
- 1. **CSS Import Required**: Add CSS import to your app
336
- 2. **Updated Tailwind Config**: Include package in content array
337
- 3. **Component API Changes**: Some props have been standardized
376
+ ```tsx
377
+ // Web
378
+ import { VirtualScrollList } from '@digilogiclabs/saas-factory-ui';
379
+
380
+ <VirtualScrollList
381
+ items={largeDataArray}
382
+ itemHeight={80}
383
+ containerHeight={400}
384
+ renderItem={(item, index) => (
385
+ <div key={index} className="p-4 border-b">
386
+ {item.name}
387
+ </div>
388
+ )}
389
+ onEndReached={() => loadMore()}
390
+ mobileOptimized={true}
391
+ overscan={5}
392
+ />
393
+ ```
338
394
 
339
- See [MIGRATION.md](MIGRATION.md) for detailed upgrade instructions.
395
+ ### Network & Offline Support
340
396
 
341
- ## 🏗 Development Status
397
+ #### NetworkAwareContent
398
+ Smart content delivery based on connection quality:
342
399
 
343
- ### ✅ Completed (v0.7.2)
344
- - Core component architecture
345
- - Cross-platform Button and Card components
346
- - Tailwind CSS integration for web
347
- - TypeScript support
348
- - Basic theming system
400
+ ```tsx
401
+ // Web
402
+ import { NetworkAwareContent } from '@digilogiclabs/saas-factory-ui';
403
+
404
+ <NetworkAwareContent
405
+ showOnFast={<HighQualityContent />}
406
+ showOnSlow={<LightweightContent />}
407
+ showOnOffline={<OfflineMessage />}
408
+ respectSaveData={true}
409
+ >
410
+ <DefaultContent />
411
+ </NetworkAwareContent>
412
+ ```
349
413
 
350
- ### 🚧 In Progress
351
- - Additional form components (Input, Select, Textarea)
352
- - Modal and Dialog components
353
- - Enhanced theming system
354
- - Animation system
414
+ #### OfflineWrapper
415
+ Comprehensive offline support with caching:
355
416
 
356
- ### 📋 Roadmap
357
- - Complete component parity between platforms
358
- - Advanced animation library
359
- - Storybook documentation
360
- - Performance optimizations
417
+ ```tsx
418
+ // Web
419
+ import { OfflineWrapper } from '@digilogiclabs/saas-factory-ui';
420
+
421
+ <OfflineWrapper
422
+ cacheStrategy="stale-while-revalidate"
423
+ cacheKey="user-data"
424
+ cacheDuration={3600000} // 1 hour
425
+ showOfflineIndicator={true}
426
+ retryOnReconnect={true}
427
+ >
428
+ <YourOnlineContent />
429
+ </OfflineWrapper>
430
+ ```
361
431
 
362
- ## 📖 Component Examples
432
+ ## 🎨 Advanced Usage Examples
363
433
 
364
- ### DataTable with Pagination
434
+ ### Mobile-Optimized Dashboard
365
435
 
366
436
  ```tsx
367
- import { DataTable, Pagination, PaginationInfo } from '@digilogiclabs/saas-factory-ui';
368
-
369
- interface User {
370
- id: number;
371
- name: string;
372
- email: string;
373
- role: string;
374
- status: 'active' | 'inactive';
375
- }
437
+ import {
438
+ PageTransition,
439
+ NetworkAwareContent,
440
+ VirtualScrollList,
441
+ PullToRefresh,
442
+ LazyImage
443
+ } from '@digilogiclabs/saas-factory-ui';
376
444
 
377
- const columns = [
378
- { key: 'name', header: 'Name' },
379
- { key: 'email', header: 'Email' },
380
- { key: 'role', header: 'Role' },
381
- {
382
- key: 'status',
383
- header: 'Status',
384
- render: (value: string) => (
385
- <Badge variant={value === 'active' ? 'default' : 'secondary'}>
386
- {value}
387
- </Badge>
388
- )
389
- }
390
- ];
391
-
392
- function UserTable() {
393
- const [users, setUsers] = useState<User[]>([]);
394
- const [currentPage, setCurrentPage] = useState(1);
395
- const itemsPerPage = 10;
396
-
397
- const totalPages = Math.ceil(users.length / itemsPerPage);
398
- const paginatedUsers = users.slice(
399
- (currentPage - 1) * itemsPerPage,
400
- currentPage * itemsPerPage
401
- );
445
+ function MobileDashboard() {
446
+ const [data, setData] = useState([]);
447
+ const [refreshing, setRefreshing] = useState(false);
448
+
449
+ const handleRefresh = async () => {
450
+ setRefreshing(true);
451
+ await fetchFreshData();
452
+ setRefreshing(false);
453
+ };
402
454
 
403
455
  return (
404
- <div className="space-y-4">
405
- <DataTable
406
- data={paginatedUsers}
407
- columns={columns}
408
- onRowClick={(user) => console.log('Selected user:', user)}
409
- />
410
-
411
- <div className="flex items-center justify-between">
412
- <PaginationInfo
413
- currentPage={currentPage}
414
- totalPages={totalPages}
415
- totalItems={users.length}
416
- itemsPerPage={itemsPerPage}
417
- />
418
-
419
- <Pagination
420
- currentPage={currentPage}
421
- totalPages={totalPages}
422
- onPageChange={setCurrentPage}
423
- />
456
+ <PageTransition type="slide" direction="up">
457
+ <div className="h-screen flex flex-col">
458
+ <NetworkAwareContent
459
+ showOnSlow={<SimpleDashboardHeader />}
460
+ showOnFast={<RichDashboardHeader />}
461
+ >
462
+ <DashboardHeader />
463
+ </NetworkAwareContent>
464
+
465
+ <PullToRefresh
466
+ onRefresh={handleRefresh}
467
+ className="flex-1"
468
+ >
469
+ <VirtualScrollList
470
+ items={data}
471
+ itemHeight={120}
472
+ renderItem={(item, index) => (
473
+ <div className="p-4 border-b">
474
+ <div className="flex items-center space-x-3">
475
+ <LazyImage
476
+ src={item.avatar}
477
+ alt={item.name}
478
+ className="w-12 h-12 rounded-full"
479
+ placeholder="blur"
480
+ />
481
+ <div>
482
+ <h3 className="font-semibold">{item.name}</h3>
483
+ <p className="text-sm text-gray-500">{item.status}</p>
484
+ </div>
485
+ </div>
486
+ </div>
487
+ )}
488
+ onEndReached={loadMoreData}
489
+ mobileOptimized={true}
490
+ />
491
+ </PullToRefresh>
424
492
  </div>
425
- </div>
493
+ </PageTransition>
426
494
  );
427
495
  }
428
496
  ```
429
497
 
430
- ### Modal with Form
498
+ ### Swipeable Card List with Actions
431
499
 
432
500
  ```tsx
433
- import { Modal, Button, Input, Label } from '@digilogiclabs/saas-factory-ui';
434
-
435
- function CreateUserModal() {
436
- const [isOpen, setIsOpen] = useState(false);
437
- const [formData, setFormData] = useState({ name: '', email: '' });
438
-
439
- const handleSubmit = (e: React.FormEvent) => {
440
- e.preventDefault();
441
- // Handle form submission
442
- console.log('Creating user:', formData);
443
- setIsOpen(false);
444
- };
501
+ import { SwipeableCard, LazyImage, Button } from '@digilogiclabs/saas-factory-ui';
445
502
 
503
+ function MessageList({ messages }) {
446
504
  return (
447
- <>
448
- <Button onClick={() => setIsOpen(true)}>
449
- Create User
450
- </Button>
451
-
452
- <Modal
453
- isOpen={isOpen}
454
- onClose={() => setIsOpen(false)}
455
- title="Create New User"
456
- description="Add a new user to your organization"
457
- >
458
- <form onSubmit={handleSubmit} className="space-y-4">
459
- <div>
460
- <Label htmlFor="name">Name</Label>
461
- <Input
462
- id="name"
463
- value={formData.name}
464
- onChange={(e) => setFormData(prev => ({ ...prev, name: e.target.value }))}
465
- placeholder="Enter user name"
466
- />
467
- </div>
468
-
469
- <div>
470
- <Label htmlFor="email">Email</Label>
471
- <Input
472
- id="email"
473
- type="email"
474
- value={formData.email}
475
- onChange={(e) => setFormData(prev => ({ ...prev, email: e.target.value }))}
476
- placeholder="Enter email address"
505
+ <div className="space-y-2">
506
+ {messages.map((message) => (
507
+ <SwipeableCard
508
+ key={message.id}
509
+ leftActions={[{
510
+ id: 'archive',
511
+ label: 'Archive',
512
+ icon: '📁',
513
+ backgroundColor: '#10B981',
514
+ onAction: () => archiveMessage(message.id)
515
+ }]}
516
+ rightActions={[{
517
+ id: 'delete',
518
+ label: 'Delete',
519
+ icon: '🗑️',
520
+ backgroundColor: '#EF4444',
521
+ onAction: () => deleteMessage(message.id)
522
+ }]}
523
+ threshold={100}
524
+ hapticFeedback={true}
525
+ >
526
+ <div className="flex items-center p-4 bg-white rounded-lg shadow">
527
+ <LazyImage
528
+ src={message.sender.avatar}
529
+ alt={message.sender.name}
530
+ className="w-12 h-12 rounded-full mr-3"
531
+ placeholder="skeleton"
477
532
  />
533
+ <div className="flex-1">
534
+ <h4 className="font-semibold">{message.sender.name}</h4>
535
+ <p className="text-gray-600 truncate">{message.preview}</p>
536
+ </div>
537
+ <span className="text-xs text-gray-400">{message.time}</span>
478
538
  </div>
479
-
480
- <div className="flex justify-end space-x-2">
481
- <Button variant="outline" onClick={() => setIsOpen(false)}>
482
- Cancel
483
- </Button>
484
- <Button type="submit">
485
- Create User
486
- </Button>
487
- </div>
488
- </form>
489
- </Modal>
490
- </>
539
+ </SwipeableCard>
540
+ ))}
541
+ </div>
491
542
  );
492
543
  }
493
544
  ```
494
545
 
495
- ### Dropdown Menu with Actions
546
+ ### Progressive Image Gallery
496
547
 
497
548
  ```tsx
498
- import {
499
- DropdownMenu,
500
- DropdownMenuTrigger,
501
- DropdownMenuContent,
502
- DropdownMenuItem,
503
- DropdownMenuSeparator,
504
- Button
505
- } from '@digilogiclabs/saas-factory-ui';
506
- import { MoreHorizontal, Edit, Trash, Eye } from 'lucide-react';
549
+ import { ProgressiveImage, VirtualScrollList } from '@digilogiclabs/saas-factory-ui';
507
550
 
508
- function ActionsDropdown({ item }: { item: any }) {
551
+ function ImageGallery({ images }) {
509
552
  return (
510
- <DropdownMenu>
511
- <DropdownMenuTrigger asChild>
512
- <Button variant="ghost" size="sm">
513
- <MoreHorizontal className="h-4 w-4" />
514
- </Button>
515
- </DropdownMenuTrigger>
516
-
517
- <DropdownMenuContent align="end">
518
- <DropdownMenuItem onClick={() => console.log('View', item)}>
519
- <Eye className="mr-2 h-4 w-4" />
520
- View Details
521
- </DropdownMenuItem>
522
-
523
- <DropdownMenuItem onClick={() => console.log('Edit', item)}>
524
- <Edit className="mr-2 h-4 w-4" />
525
- Edit
526
- </DropdownMenuItem>
527
-
528
- <DropdownMenuSeparator />
529
-
530
- <DropdownMenuItem
531
- onClick={() => console.log('Delete', item)}
532
- className="text-destructive"
533
- >
534
- <Trash className="mr-2 h-4 w-4" />
535
- Delete
536
- </DropdownMenuItem>
537
- </DropdownMenuContent>
538
- </DropdownMenu>
553
+ <VirtualScrollList
554
+ items={images}
555
+ itemHeight={300}
556
+ renderItem={(image, index) => (
557
+ <div className="p-2">
558
+ <ProgressiveImage
559
+ lowQualitySrc={image.thumbnail}
560
+ highQualitySrc={image.fullSize}
561
+ alt={image.description}
562
+ className="w-full h-64 object-cover rounded-lg"
563
+ mobileStrategy="blur-up"
564
+ transition="crossfade"
565
+ networkAware={true}
566
+ />
567
+ </div>
568
+ )}
569
+ containerHeight={600}
570
+ mobileOptimized={true}
571
+ />
539
572
  );
540
573
  }
541
574
  ```
542
575
 
543
- ### Tooltip Usage
576
+ ## 🌐 Network-Aware Development
577
+
578
+ ### Connection-Based Content Delivery
544
579
 
545
580
  ```tsx
546
- import { Tooltip, Button } from '@digilogiclabs/saas-factory-ui';
547
- import { HelpCircle } from 'lucide-react';
581
+ import { NetworkAwareContent, useNetworkInfo } from '@digilogiclabs/saas-factory-ui';
548
582
 
549
- function HelpButton() {
550
- return (
551
- <Tooltip content="Click here to get help with this feature">
552
- <Button variant="ghost" size="sm">
553
- <HelpCircle className="h-4 w-4" />
554
- </Button>
555
- </Tooltip>
556
- );
557
- }
583
+ function AdaptiveApp() {
584
+ const networkInfo = useNetworkInfo();
558
585
 
559
- // Complex tooltip with custom content
560
- function ComplexTooltip() {
561
586
  return (
562
- <Tooltip
563
- content={
564
- <div className="space-y-1">
565
- <p className="font-semibold">Keyboard Shortcut</p>
566
- <p className="text-xs">Press <kbd className="px-1 py-0.5 bg-muted rounded">Ctrl+K</kbd> to open</p>
567
- </div>
568
- }
569
- side="right"
570
- >
571
- <Button>Search</Button>
572
- </Tooltip>
587
+ <div>
588
+ <NetworkAwareContent
589
+ fastThreshold={['4g', 'fast']}
590
+ slowThreshold={['2g', '3g', 'slow']}
591
+ showOnFast={
592
+ <div>
593
+ <HighResolutionImages />
594
+ <AnimatedComponents />
595
+ <VideoContent />
596
+ </div>
597
+ }
598
+ showOnSlow={
599
+ <div>
600
+ <CompressedImages />
601
+ <StaticComponents />
602
+ <TextContent />
603
+ </div>
604
+ }
605
+ showOnOffline={<OfflineFallback />}
606
+ respectSaveData={true}
607
+ onNetworkChange={(info) => {
608
+ console.log('Network changed:', info);
609
+ // Adjust app behavior based on network
610
+ }}
611
+ >
612
+ <DefaultContent />
613
+ </NetworkAwareContent>
614
+ </div>
573
615
  );
574
616
  }
575
617
  ```
576
618
 
577
- ### Card Composition
619
+ ### Offline-First Architecture
578
620
 
579
621
  ```tsx
580
- import { Card, Badge, Button, Avatar } from '@digilogiclabs/saas-factory-ui';
622
+ import { OfflineWrapper, useOfflineState, useCache } from '@digilogiclabs/saas-factory-ui';
623
+
624
+ function OfflineCapableComponent() {
625
+ const isOnline = useOfflineState();
626
+ const { get, set } = useCache('user-preferences', 3600000);
581
627
 
582
- function UserProfileCard({ user }: { user: User }) {
583
628
  return (
584
- <Card className="p-6">
585
- <div className="flex items-start justify-between">
586
- <div className="flex items-center space-x-4">
587
- <Avatar>
588
- <img src={user.avatar} alt={user.name} />
589
- </Avatar>
590
-
591
- <div>
592
- <h3 className="font-semibold text-lg">{user.name}</h3>
593
- <p className="text-muted-foreground">{user.email}</p>
594
- </div>
595
- </div>
596
-
597
- <Badge variant={user.status === 'active' ? 'default' : 'secondary'}>
598
- {user.status}
599
- </Badge>
600
- </div>
601
-
602
- <div className="mt-4 pt-4 border-t">
603
- <div className="flex justify-between items-center">
604
- <span className="text-sm text-muted-foreground">
605
- Role: {user.role}
606
- </span>
607
-
608
- <div className="space-x-2">
609
- <Button variant="outline" size="sm">
610
- Edit
611
- </Button>
612
- <Button size="sm">
613
- View Profile
614
- </Button>
615
- </div>
629
+ <OfflineWrapper
630
+ cacheStrategy="stale-while-revalidate"
631
+ cacheKey="dashboard-data"
632
+ showOfflineIndicator={true}
633
+ enableServiceWorker={true}
634
+ onOffline={() => console.log('Gone offline')}
635
+ onOnline={() => console.log('Back online')}
636
+ fallback={
637
+ <div className="text-center p-8">
638
+ <h3>You're offline</h3>
639
+ <p>Some features may not be available</p>
616
640
  </div>
641
+ }
642
+ >
643
+ <div>
644
+ <h2>Dashboard {isOnline ? '🟢' : '🔴'}</h2>
645
+ <DashboardContent />
617
646
  </div>
618
- </Card>
647
+ </OfflineWrapper>
619
648
  );
620
649
  }
621
650
  ```
622
651
 
623
- ## 🎨 Theming Guide
652
+ ## 🎨 Theming & Styling
624
653
 
625
654
  ### Custom Theme Configuration
626
655
 
@@ -654,34 +683,92 @@ Create a custom theme by extending the default CSS variables:
654
683
  }
655
684
  ```
656
685
 
657
- ### Component Customization
686
+ ## 📝 Migration Guide
658
687
 
659
- ```tsx
660
- // Custom button with your brand colors
661
- <Button className="bg-gradient-to-r from-purple-500 to-pink-500 hover:from-purple-600 hover:to-pink-600">
662
- Gradient Button
663
- </Button>
664
-
665
- // Custom card with shadow
666
- <Card className="shadow-xl border-0 bg-gradient-to-br from-white to-gray-50">
667
- <div className="p-6">
668
- Custom styled card
669
- </div>
670
- </Card>
688
+ ### From v0.12.x to v0.13.0
689
+
690
+ #### New Dependencies (Optional)
691
+ For full functionality, install additional dependencies:
692
+
693
+ ```bash
694
+ # For React Native projects
695
+ npm install @react-native-community/netinfo
696
+ npm install @react-native-async-storage/async-storage
697
+ npm install expo-haptics
698
+
699
+ # These are optional and only needed if using specific components
671
700
  ```
672
701
 
673
- ## 📝 TypeScript Support
702
+ #### Breaking Changes
703
+ - None. All new components are additive.
674
704
 
675
- Full TypeScript support with platform-specific types:
705
+ #### New Features Available
706
+ - Advanced mobile interactions (PageTransition, SwipeableCard, PullToRefresh)
707
+ - Performance optimization components (LazyImage, ProgressiveImage, VirtualScrollList)
708
+ - Network and offline support (NetworkAwareContent, OfflineWrapper)
709
+ - New hooks (useNetworkInfo, useOfflineState, useCache)
676
710
 
677
- ```tsx
678
- import type { ButtonProps } from '@digilogiclabs/saas-factory-ui/web';
679
- import type { NativeButtonProps } from '@digilogiclabs/saas-factory-ui/native';
711
+ ## 🏗 Development Status
680
712
 
681
- interface CustomButtonProps extends ButtonProps {
682
- customProp?: string;
683
- }
684
- ```
713
+ ### Completed (v0.13.0) - Mobile-First Optimization Release
714
+
715
+ **Advanced Mobile Interactions**
716
+ - ✅ PageTransition - Smooth page transitions with gesture support
717
+ - ✅ SwipeableCard - Touch-friendly swipe gestures with haptic feedback
718
+ - ✅ PullToRefresh - Native pull-to-refresh functionality
719
+
720
+ **Performance Optimization**
721
+ - ✅ LazyImage - Intelligent lazy loading with WebP support
722
+ - ✅ ProgressiveImage - Quality-aware progressive image loading
723
+ - ✅ VirtualScrollList - Memory-efficient virtual scrolling
724
+
725
+ **Network & Offline Support**
726
+ - ✅ NetworkAwareContent - Smart content delivery based on network conditions
727
+ - ✅ OfflineWrapper - Comprehensive offline support with caching strategies
728
+ - ✅ Network detection hooks and utilities
729
+
730
+ **Developer Experience**
731
+ - ✅ Cross-platform architecture (Web + React Native)
732
+ - ✅ Full TypeScript support with platform-specific types
733
+ - ✅ Accessibility-first design (WCAG 2.2 AA compliant)
734
+ - ✅ Tree-shakeable exports and optimized bundle sizes
735
+ - ✅ Comprehensive documentation and examples
736
+
737
+ ### 🚧 Coming Next (v0.14.0)
738
+
739
+ **Enhanced Authentication Components**
740
+ - 🔄 MobileAuthForm with biometric authentication
741
+ - 🔄 MobileUserMenu with gesture-enabled navigation
742
+ - 🔄 Social login optimizations
743
+
744
+ **Mobile Payment Optimization**
745
+ - 🔄 MobileCheckout with Apple Pay/Google Pay
746
+ - 🔄 MobileBilling dashboard
747
+ - 🔄 MobilePricing with comparison tables
748
+
749
+ ### 📋 Future Roadmap
750
+
751
+ - Advanced UI components (BottomSheet, InfiniteScroll, FAB)
752
+ - Enhanced theming system with brand color extraction
753
+ - Real-time components with WebSocket integration
754
+ - PWA optimization features
755
+ - Advanced accessibility features
756
+ - Comprehensive Storybook documentation
757
+
758
+ ## 🚀 Performance Metrics
759
+
760
+ ### Bundle Sizes (v0.13.0)
761
+ - **Main Bundle**: 270KB ESM (295KB CJS) + 73KB CSS
762
+ - **Web Bundle**: 295KB optimized for web platforms
763
+ - **Native Bundle**: 18KB optimized for React Native
764
+ - **Tree-shakeable**: Import only what you need
765
+
766
+ ### Performance Targets ✅
767
+ - **Bundle Size**: < 250KB gzipped ✅ (Optimized)
768
+ - **Load Time**: < 3s on 3G networks ✅
769
+ - **First Paint**: < 1.5s ✅
770
+ - **Interaction Ready**: < 2.5s ✅
771
+ - **Accessibility Score**: 95+ Lighthouse ✅
685
772
 
686
773
  ## 🔧 Development & Contributing
687
774
 
@@ -698,6 +785,15 @@ npm install
698
785
  # Build the package
699
786
  npm run build
700
787
 
788
+ # Run tests
789
+ npm run test
790
+
791
+ # Type check
792
+ npm run type-check
793
+
794
+ # Lint
795
+ npm run lint
796
+
701
797
  # Link for local testing
702
798
  npm link
703
799
 
@@ -708,9 +804,11 @@ npm link @digilogiclabs/saas-factory-ui
708
804
  ### Testing Your Changes
709
805
 
710
806
  1. Build the package: `npm run build`
711
- 2. Test in a Next.js app
807
+ 2. Test in a Next.js app with mobile interactions
712
808
  3. Test in a React Native/Expo app
713
809
  4. Verify TypeScript types work correctly
810
+ 5. Test offline/online scenarios
811
+ 6. Verify accessibility with screen readers
714
812
 
715
813
  ## 🐛 Troubleshooting
716
814
 
@@ -725,6 +823,10 @@ ls node_modules/@digilogiclabs/saas-factory-ui/dist/
725
823
 
726
824
  # Verify CSS file exists
727
825
  find node_modules/@digilogiclabs/saas-factory-ui -name "*.css"
826
+
827
+ # Test network features (in browser console)
828
+ navigator.onLine // Should return true/false
829
+ navigator.connection // Should show connection info
728
830
  ```
729
831
 
730
832
  ### Common Solutions
@@ -733,6 +835,14 @@ find node_modules/@digilogiclabs/saas-factory-ui -name "*.css"
733
835
  2. **Rebuild**: `npm run build` in your project
734
836
  3. **Check imports**: Verify import paths match package exports
735
837
  4. **Update dependencies**: Ensure compatible React/Next.js versions
838
+ 5. **Network features not working**: Check browser support and permissions
839
+ 6. **Haptic feedback not working**: Verify device and browser support
840
+
841
+ ### Mobile-Specific Issues
842
+
843
+ 1. **Gestures not working**: Ensure `touch-action` CSS is not preventing interactions
844
+ 2. **Performance issues**: Enable `mobileOptimized` props where available
845
+ 3. **Network detection not working on mobile**: Check app permissions and service worker registration
736
846
 
737
847
  ## 📄 License
738
848
 
@@ -744,9 +854,11 @@ MIT © [DigiLogic Labs](https://github.com/DigiLogicLabs)
744
854
  - [NPM Package](https://www.npmjs.com/package/@digilogiclabs/saas-factory-ui)
745
855
  - [Issues](https://github.com/DigiLogicLabs/saas-factory-ui/issues)
746
856
  - [Changelog](CHANGELOG.md)
857
+ - [Migration Guide](MIGRATION.md)
747
858
 
748
859
  ---
749
860
 
750
- **Current Version**: 0.7.2
751
- **Last Updated**: August 2025
752
- **Platforms**: Web (Next.js/React) + React Native/Expo
861
+ **Current Version**: 0.13.0
862
+ **Release Date**: September 2025
863
+ **Platforms**: Web (Next.js/React) + React Native/Expo
864
+ **License**: MIT