@umituz/react-native-design-system 4.27.29 → 4.27.31
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/dist/device/detection/iPadLayoutUtils.d.ts +2 -0
- package/dist/molecules/alerts/AlertService.d.ts +11 -0
- package/dist/molecules/alerts/index.d.ts +2 -1
- package/dist/responsive/config.d.ts +1 -1
- package/dist/storage/domain/factories/StoreFactory.d.ts +5 -1
- package/dist/storage/index.d.ts +16 -0
- package/dist/storage/infrastructure/adapters/ZustandStorageAdapter.d.ts +32 -0
- package/dist/utilities/index.d.ts +4 -3
- package/package.json +1 -1
- package/src/molecules/alerts/AlertService.ts +43 -0
- package/src/molecules/alerts/index.ts +3 -2
- package/src/storage/index.ts +7 -7
- package/src/storage/infrastructure/adapters/ZustandStorageAdapter.ts +13 -8
|
@@ -19,6 +19,8 @@ export declare function getTouchTargetSize(): number;
|
|
|
19
19
|
export declare function getIPadScreenPadding(): number;
|
|
20
20
|
/**
|
|
21
21
|
* Get font scale for iPad
|
|
22
|
+
* Optimized for readability - Apple HIG recommends slightly larger fonts on iPad
|
|
23
|
+
* but not too large to avoid crowding
|
|
22
24
|
*/
|
|
23
25
|
export declare function getIPadFontScale(): number;
|
|
24
26
|
export interface IPadLayoutInfo {
|
|
@@ -11,4 +11,15 @@ export declare class AlertService {
|
|
|
11
11
|
static createErrorAlert(title: string, message?: string, options?: AlertOptions): Alert;
|
|
12
12
|
static createWarningAlert(title: string, message?: string, options?: AlertOptions): Alert;
|
|
13
13
|
static createInfoAlert(title: string, message?: string, options?: AlertOptions): Alert;
|
|
14
|
+
/**
|
|
15
|
+
* Convenience methods to show alerts directly from outside React components
|
|
16
|
+
* These access the Zustand store directly without requiring hooks
|
|
17
|
+
*/
|
|
18
|
+
static success(title: string, message?: string, options?: AlertOptions): string;
|
|
19
|
+
static error(title: string, message?: string, options?: AlertOptions): string;
|
|
20
|
+
static warning(title: string, message?: string, options?: AlertOptions): string;
|
|
21
|
+
static info(title: string, message?: string, options?: AlertOptions): string;
|
|
22
|
+
static show(type: AlertType, mode: AlertMode, title: string, message?: string, options?: AlertOptions): string;
|
|
23
|
+
static dismiss(id: string): void;
|
|
24
|
+
static clear(): void;
|
|
14
25
|
}
|
|
@@ -13,6 +13,7 @@ export { AlertContainer } from './AlertContainer';
|
|
|
13
13
|
export { AlertInline } from './AlertInline';
|
|
14
14
|
export { AlertModal } from './AlertModal';
|
|
15
15
|
export { AlertToast } from './AlertToast';
|
|
16
|
-
export
|
|
16
|
+
export { AlertType, AlertMode } from './AlertTypes';
|
|
17
|
+
export type { AlertPosition, AlertAction, AlertOptions, Alert } from './AlertTypes';
|
|
17
18
|
export * from './components';
|
|
18
19
|
export * from './hooks';
|
|
@@ -46,7 +46,7 @@ export declare const SIZE_CONSTRAINTS: {
|
|
|
46
46
|
readonly INPUT_MAX_LARGE: 200;
|
|
47
47
|
readonly ICON_MAX_SMALL: 120;
|
|
48
48
|
readonly ICON_MAX_TABLET: 180;
|
|
49
|
-
readonly CONTENT_MAX_TABLET:
|
|
49
|
+
readonly CONTENT_MAX_TABLET: 672;
|
|
50
50
|
readonly MODAL_MIN_SMALL: 250;
|
|
51
51
|
readonly MODAL_MIN_STANDARD: 300;
|
|
52
52
|
readonly MODAL_MIN_TABLET: 350;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Store Factory
|
|
3
|
-
* Create Zustand stores with
|
|
3
|
+
* Create Zustand stores with optional persistence and actions
|
|
4
|
+
*
|
|
5
|
+
* NOTE: For persistence, provide a storage implementation.
|
|
6
|
+
* Use `storageRepository` from '@umituz/react-native-design-system/storage'
|
|
7
|
+
* for a centralized AsyncStorage abstraction.
|
|
4
8
|
*/
|
|
5
9
|
import type { StoreApi } from 'zustand';
|
|
6
10
|
import type { StoreConfig } from '../types/Store';
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -33,6 +33,22 @@ export type { IStorageRepository } from './application/ports/IStorageRepository'
|
|
|
33
33
|
export { AsyncStorageRepository, storageRepository, } from './infrastructure/repositories/AsyncStorageRepository';
|
|
34
34
|
export { storageService } from './infrastructure/adapters/StorageService';
|
|
35
35
|
export type { StateStorage } from './domain/types/Store';
|
|
36
|
+
/**
|
|
37
|
+
* Persistent storage export
|
|
38
|
+
*
|
|
39
|
+
* AsyncStorage natively provides the Promise-based API that state management libraries expect.
|
|
40
|
+
* This is a centralized export for all persistent stores to use.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* import { createStore, persistentStorage } from '@umituz/react-native-design-system/storage';
|
|
44
|
+
*
|
|
45
|
+
* createStore({
|
|
46
|
+
* persist: true,
|
|
47
|
+
* storage: persistentStorage,
|
|
48
|
+
* ...
|
|
49
|
+
* });
|
|
50
|
+
*/
|
|
51
|
+
export { persistentStorage, zustandStorage } from './infrastructure/adapters/ZustandStorageAdapter';
|
|
36
52
|
export { useStorage } from './presentation/hooks/useStorage';
|
|
37
53
|
export { useStorageState } from './presentation/hooks/useStorageState';
|
|
38
54
|
export { useStore } from './presentation/hooks/useStore';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistent Storage Adapter
|
|
3
|
+
*
|
|
4
|
+
* Provides AsyncStorage in a format compatible with state management persist middleware.
|
|
5
|
+
*
|
|
6
|
+
* AsyncStorage natively supports the Promise-based API that state libraries expect:
|
|
7
|
+
* - getItem: (key: string) => Promise<string | null>
|
|
8
|
+
* - setItem: (key: string, value: string) => Promise<void>
|
|
9
|
+
* - removeItem: (key: string) => Promise<void>
|
|
10
|
+
*
|
|
11
|
+
* This is a centralized export point for persistent stores throughout the app.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* import { createStore, persistentStorage } from '@umituz/react-native-design-system/storage';
|
|
15
|
+
*
|
|
16
|
+
* const store = createStore({
|
|
17
|
+
* persist: true,
|
|
18
|
+
* storage: persistentStorage,
|
|
19
|
+
* ...
|
|
20
|
+
* });
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Persistent storage export
|
|
24
|
+
*
|
|
25
|
+
* AsyncStorage instance that can be used directly with state management persist middleware.
|
|
26
|
+
* No wrapping needed - AsyncStorage already provides the correct interface.
|
|
27
|
+
*/
|
|
28
|
+
export declare const persistentStorage: import("@react-native-async-storage/async-storage").AsyncStorageStatic;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Use persistentStorage instead
|
|
31
|
+
*/
|
|
32
|
+
export declare const zustandStorage: import("@react-native-async-storage/async-storage").AsyncStorageStatic;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "4.27.
|
|
3
|
+
"version": "4.27.31",
|
|
4
4
|
"description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive, safe area, exception, infinite scroll, UUID, image, timezone, offline, onboarding, and loading utilities - TanStack persistence and expo-image-manipulator now lazy loaded",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { generateUUID } from '../../uuid';
|
|
6
6
|
import { Alert, AlertType, AlertMode, AlertOptions, AlertPosition } from './AlertTypes';
|
|
7
|
+
import { useAlertStore } from './AlertStore';
|
|
7
8
|
|
|
8
9
|
export class AlertService {
|
|
9
10
|
/**
|
|
@@ -57,4 +58,46 @@ export class AlertService {
|
|
|
57
58
|
static createInfoAlert(title: string, message?: string, options?: AlertOptions): Alert {
|
|
58
59
|
return this.createAlert(AlertType.INFO, AlertMode.TOAST, title, message, options);
|
|
59
60
|
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Convenience methods to show alerts directly from outside React components
|
|
64
|
+
* These access the Zustand store directly without requiring hooks
|
|
65
|
+
*/
|
|
66
|
+
static success(title: string, message?: string, options?: AlertOptions): string {
|
|
67
|
+
const alert = this.createSuccessAlert(title, message, options);
|
|
68
|
+
useAlertStore.getState().addAlert(alert);
|
|
69
|
+
return alert.id;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
static error(title: string, message?: string, options?: AlertOptions): string {
|
|
73
|
+
const alert = this.createErrorAlert(title, message, options);
|
|
74
|
+
useAlertStore.getState().addAlert(alert);
|
|
75
|
+
return alert.id;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static warning(title: string, message?: string, options?: AlertOptions): string {
|
|
79
|
+
const alert = this.createWarningAlert(title, message, options);
|
|
80
|
+
useAlertStore.getState().addAlert(alert);
|
|
81
|
+
return alert.id;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static info(title: string, message?: string, options?: AlertOptions): string {
|
|
85
|
+
const alert = this.createInfoAlert(title, message, options);
|
|
86
|
+
useAlertStore.getState().addAlert(alert);
|
|
87
|
+
return alert.id;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
static show(type: AlertType, mode: AlertMode, title: string, message?: string, options?: AlertOptions): string {
|
|
91
|
+
const alert = this.createAlert(type, mode, title, message, options);
|
|
92
|
+
useAlertStore.getState().addAlert(alert);
|
|
93
|
+
return alert.id;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
static dismiss(id: string): void {
|
|
97
|
+
useAlertStore.getState().dismissAlert(id);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
static clear(): void {
|
|
101
|
+
useAlertStore.getState().clearAlerts();
|
|
102
|
+
}
|
|
60
103
|
}
|
|
@@ -17,8 +17,9 @@ export { AlertInline } from './AlertInline';
|
|
|
17
17
|
export { AlertModal } from './AlertModal';
|
|
18
18
|
export { AlertToast } from './AlertToast';
|
|
19
19
|
|
|
20
|
-
// Types
|
|
21
|
-
export
|
|
20
|
+
// Types - Enums exported as values
|
|
21
|
+
export { AlertType, AlertMode } from './AlertTypes';
|
|
22
|
+
export type { AlertPosition, AlertAction, AlertOptions, Alert } from './AlertTypes';
|
|
22
23
|
|
|
23
24
|
// Sub-exports
|
|
24
25
|
export * from './components';
|
package/src/storage/index.ts
CHANGED
|
@@ -128,25 +128,25 @@ export { storageService } from './infrastructure/adapters/StorageService';
|
|
|
128
128
|
export type { StateStorage } from './domain/types/Store';
|
|
129
129
|
|
|
130
130
|
// =============================================================================
|
|
131
|
-
//
|
|
131
|
+
// PERSISTENT STORAGE - Sync API for state management persist middleware
|
|
132
132
|
// =============================================================================
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
|
-
*
|
|
135
|
+
* Persistent storage export
|
|
136
136
|
*
|
|
137
|
-
* AsyncStorage natively provides the Promise-based API that
|
|
138
|
-
* This is a centralized export for all
|
|
137
|
+
* AsyncStorage natively provides the Promise-based API that state management libraries expect.
|
|
138
|
+
* This is a centralized export for all persistent stores to use.
|
|
139
139
|
*
|
|
140
140
|
* @example
|
|
141
|
-
* import { createStore,
|
|
141
|
+
* import { createStore, persistentStorage } from '@umituz/react-native-design-system/storage';
|
|
142
142
|
*
|
|
143
143
|
* createStore({
|
|
144
144
|
* persist: true,
|
|
145
|
-
* storage:
|
|
145
|
+
* storage: persistentStorage,
|
|
146
146
|
* ...
|
|
147
147
|
* });
|
|
148
148
|
*/
|
|
149
|
-
export { zustandStorage } from './infrastructure/adapters/ZustandStorageAdapter';
|
|
149
|
+
export { persistentStorage, zustandStorage } from './infrastructure/adapters/ZustandStorageAdapter';
|
|
150
150
|
|
|
151
151
|
// =============================================================================
|
|
152
152
|
// PRESENTATION LAYER - Hooks
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Persistent Storage Adapter
|
|
3
3
|
*
|
|
4
|
-
* Provides AsyncStorage in a format compatible with
|
|
4
|
+
* Provides AsyncStorage in a format compatible with state management persist middleware.
|
|
5
5
|
*
|
|
6
|
-
* AsyncStorage natively supports the Promise-based API that
|
|
6
|
+
* AsyncStorage natively supports the Promise-based API that state libraries expect:
|
|
7
7
|
* - getItem: (key: string) => Promise<string | null>
|
|
8
8
|
* - setItem: (key: string, value: string) => Promise<void>
|
|
9
9
|
* - removeItem: (key: string) => Promise<void>
|
|
10
10
|
*
|
|
11
|
-
* This is a centralized export point for
|
|
11
|
+
* This is a centralized export point for persistent stores throughout the app.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
|
-
* import { createStore,
|
|
14
|
+
* import { createStore, persistentStorage } from '@umituz/react-native-design-system/storage';
|
|
15
15
|
*
|
|
16
16
|
* const store = createStore({
|
|
17
17
|
* persist: true,
|
|
18
|
-
* storage:
|
|
18
|
+
* storage: persistentStorage,
|
|
19
19
|
* ...
|
|
20
20
|
* });
|
|
21
21
|
*/
|
|
@@ -23,9 +23,14 @@
|
|
|
23
23
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Persistent storage export
|
|
27
27
|
*
|
|
28
|
-
* AsyncStorage instance that can be used directly with
|
|
28
|
+
* AsyncStorage instance that can be used directly with state management persist middleware.
|
|
29
29
|
* No wrapping needed - AsyncStorage already provides the correct interface.
|
|
30
30
|
*/
|
|
31
|
+
export const persistentStorage = AsyncStorage;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated Use persistentStorage instead
|
|
35
|
+
*/
|
|
31
36
|
export const zustandStorage = AsyncStorage;
|