@umituz/react-native-design-system 4.26.12 → 4.27.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/dist/molecules/ListItem.d.ts +1 -1
- package/dist/molecules/action-footer/ActionFooter.d.ts +1 -1
- package/dist/molecules/icon-grid/IconGrid.d.ts +1 -1
- package/dist/molecules/navigation/index.d.ts +78 -0
- package/dist/onboarding/presentation/components/OnboardingFooter.d.ts +1 -1
- package/dist/onboarding/presentation/components/OnboardingHeader.d.ts +1 -1
- package/dist/utils/math/CalculationUtils.d.ts +69 -0
- package/dist/utils/math/OpacityUtils.d.ts +31 -0
- package/dist/utils/math/ProgressUtils.d.ts +37 -0
- package/dist/utils/math/index.d.ts +6 -0
- package/package.json +1 -1
- package/src/molecules/navigation/index.ts +84 -0
|
@@ -8,14 +8,92 @@ export type { BottomTabScreenProps, BottomTabNavigationOptions, } from "@react-n
|
|
|
8
8
|
export { DEFAULT_FAB_CONFIG } from "./types";
|
|
9
9
|
export { NavigationCleanupManager } from "./utils/NavigationCleanup";
|
|
10
10
|
export type { NavigationCleanup } from "./utils/NavigationCleanup";
|
|
11
|
+
/**
|
|
12
|
+
* AppNavigation - Global navigation utility for programmatic navigation outside React components.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { AppNavigation } from '@umituz/react-native-design-system/molecules';
|
|
17
|
+
*
|
|
18
|
+
* // Navigate from a non-React context
|
|
19
|
+
* AppNavigation.navigate('ScreenName', { param: 'value' });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
11
22
|
export { AppNavigation } from "./utils/AppNavigation";
|
|
12
23
|
export { TabLabel, type TabLabelProps } from "./components/TabLabel";
|
|
13
24
|
export * from "./components/NavigationHeader";
|
|
14
25
|
export { useTabBarStyles, type TabBarConfig } from "./hooks/useTabBarStyles";
|
|
15
26
|
export { useTabConfig, type UseTabConfigProps } from "./hooks/useTabConfig";
|
|
27
|
+
/**
|
|
28
|
+
* useAppNavigation - Standard navigation hook for all React Native packages.
|
|
29
|
+
*
|
|
30
|
+
* Provides a clean, type-safe navigation API that wraps React Navigation.
|
|
31
|
+
* Use this hook instead of @react-navigation/native's useNavigation for consistency.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* import { useAppNavigation } from '@umituz/react-native-design-system/molecules';
|
|
36
|
+
*
|
|
37
|
+
* function MyScreen() {
|
|
38
|
+
* const navigation = useAppNavigation();
|
|
39
|
+
*
|
|
40
|
+
* return (
|
|
41
|
+
* <Button onPress={() => navigation.navigate('Details', { id: 123 })}>
|
|
42
|
+
* Go to Details
|
|
43
|
+
* </Button>
|
|
44
|
+
* );
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
16
48
|
export { useAppNavigation } from "./hooks/useAppNavigation";
|
|
49
|
+
export type { AppNavigationResult } from "./hooks/useAppNavigation";
|
|
50
|
+
/**
|
|
51
|
+
* useAppRoute - Hook to access current route parameters.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* import { useAppRoute } from '@umituz/react-native-design-system/molecules';
|
|
56
|
+
*
|
|
57
|
+
* function DetailsScreen() {
|
|
58
|
+
* const route = useAppRoute<{ id: number }>();
|
|
59
|
+
* const id = route.params?.id;
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
17
63
|
export { useAppRoute, type RouteProp } from "./hooks/useAppRoute";
|
|
64
|
+
/**
|
|
65
|
+
* useAppFocusEffect - Run effects when screen comes into focus.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* import { useAppFocusEffect } from '@umituz/react-native-design-system/molecules';
|
|
70
|
+
* import { useCallback } from 'react';
|
|
71
|
+
*
|
|
72
|
+
* function ProfileScreen() {
|
|
73
|
+
* useAppFocusEffect(
|
|
74
|
+
* useCallback(() => {
|
|
75
|
+
* console.log('Screen focused');
|
|
76
|
+
* return () => console.log('Screen unfocused');
|
|
77
|
+
* }, [])
|
|
78
|
+
* );
|
|
79
|
+
* }
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
18
82
|
export { useAppFocusEffect } from "./hooks/useAppFocusEffect";
|
|
83
|
+
/**
|
|
84
|
+
* useAppIsFocused - Check if current screen is focused.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* import { useAppIsFocused } from '@umituz/react-native-design-system/molecules';
|
|
89
|
+
*
|
|
90
|
+
* function VideoPlayer() {
|
|
91
|
+
* const isFocused = useAppIsFocused();
|
|
92
|
+
*
|
|
93
|
+
* return <Video playing={isFocused} />;
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
19
97
|
export { useAppIsFocused } from "./hooks/useAppIsFocused";
|
|
20
98
|
export { createScreenOptions } from "./utils/createScreenOptions";
|
|
21
99
|
export type { ScreenOptionsParams } from "./utils/createScreenOptions";
|
|
@@ -9,4 +9,4 @@ export interface OnboardingFooterProps {
|
|
|
9
9
|
showProgressText?: boolean;
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
}
|
|
12
|
-
export declare const OnboardingFooter:
|
|
12
|
+
export declare const OnboardingFooter: React.NamedExoticComponent<OnboardingFooterProps>;
|
|
@@ -7,4 +7,4 @@ export interface OnboardingHeaderProps {
|
|
|
7
7
|
showSkipButton?: boolean;
|
|
8
8
|
skipButtonText?: string;
|
|
9
9
|
}
|
|
10
|
-
export declare const OnboardingHeader:
|
|
10
|
+
export declare const OnboardingHeader: React.NamedExoticComponent<OnboardingHeaderProps>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculation Utilities
|
|
3
|
+
*
|
|
4
|
+
* Common mathematical calculations used throughout the app
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Clamps a number between a minimum and maximum value
|
|
8
|
+
* @param value - The value to clamp
|
|
9
|
+
* @param min - Minimum allowed value (default: 0)
|
|
10
|
+
* @param max - Maximum allowed value (default: 100)
|
|
11
|
+
* @returns Clamped value
|
|
12
|
+
*/
|
|
13
|
+
export declare function clamp(value: number, min?: number, max?: number): number;
|
|
14
|
+
/**
|
|
15
|
+
* Calculates progress percentage
|
|
16
|
+
* @param current - Current value
|
|
17
|
+
* @param total - Total value
|
|
18
|
+
* @returns Percentage (0-100)
|
|
19
|
+
*/
|
|
20
|
+
export declare function calculatePercentage(current: number, total: number): number;
|
|
21
|
+
/**
|
|
22
|
+
* Rounds a number to specified decimal places
|
|
23
|
+
* @param value - The value to round
|
|
24
|
+
* @param decimals - Number of decimal places (default: 0)
|
|
25
|
+
* @returns Rounded value
|
|
26
|
+
*/
|
|
27
|
+
export declare function roundTo(value: number, decimals?: number): number;
|
|
28
|
+
/**
|
|
29
|
+
* Converts intensity (0-100) to opacity (0-1)
|
|
30
|
+
* @param intensity - Intensity value (0-100)
|
|
31
|
+
* @param minOpacity - Minimum opacity (default: 0.05)
|
|
32
|
+
* @param maxOpacity - Maximum opacity (default: 0.95)
|
|
33
|
+
* @returns Opacity value (0-1)
|
|
34
|
+
*/
|
|
35
|
+
export declare function intensityToOpacity(intensity: number, minOpacity?: number, maxOpacity?: number): number;
|
|
36
|
+
/**
|
|
37
|
+
* Calculates grid item width based on container width and columns
|
|
38
|
+
* @param containerWidth - Total container width
|
|
39
|
+
* @param columns - Number of columns
|
|
40
|
+
* @param gap - Gap between items in pixels
|
|
41
|
+
* @returns Item width in pixels
|
|
42
|
+
*/
|
|
43
|
+
export declare function calculateGridItemWidth(containerWidth: number, columns: number, gap: number): number;
|
|
44
|
+
/**
|
|
45
|
+
* Checks if a value is within a range (inclusive)
|
|
46
|
+
* @param value - Value to check
|
|
47
|
+
* @param min - Range minimum
|
|
48
|
+
* @param max - Range maximum
|
|
49
|
+
* @returns True if value is in range
|
|
50
|
+
*/
|
|
51
|
+
export declare function isInRange(value: number, min: number, max: number): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Linear interpolation between two values
|
|
54
|
+
* @param start - Start value
|
|
55
|
+
* @param end - End value
|
|
56
|
+
* @param progress - Progress (0-1)
|
|
57
|
+
* @returns Interpolated value
|
|
58
|
+
*/
|
|
59
|
+
export declare function lerp(start: number, end: number, progress: number): number;
|
|
60
|
+
/**
|
|
61
|
+
* Maps a value from one range to another
|
|
62
|
+
* @param value - Value to map
|
|
63
|
+
* @param inMin - Input range minimum
|
|
64
|
+
* @param inMax - Input range maximum
|
|
65
|
+
* @param outMin - Output range minimum
|
|
66
|
+
* @param outMax - Output range maximum
|
|
67
|
+
* @returns Mapped value
|
|
68
|
+
*/
|
|
69
|
+
export declare function mapRange(value: number, inMin: number, inMax: number, outMin: number, outMax: number): number;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opacity Utilities
|
|
3
|
+
*
|
|
4
|
+
* Helper functions for opacity-related calculations
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Converts intensity value to opacity for glassmorphism effects
|
|
8
|
+
* @param intensity - Intensity value (0-100)
|
|
9
|
+
* @param options - Configuration options
|
|
10
|
+
* @returns Opacity value (0-1)
|
|
11
|
+
*/
|
|
12
|
+
export declare function intensityToOpacity(intensity: number, options?: {
|
|
13
|
+
minOpacity?: number;
|
|
14
|
+
maxOpacity?: number;
|
|
15
|
+
invert?: boolean;
|
|
16
|
+
}): number;
|
|
17
|
+
/**
|
|
18
|
+
* Creates an RGBA color string with specified opacity
|
|
19
|
+
* @param rgb - RGB color as array [r, g, b]
|
|
20
|
+
* @param opacity - Opacity value (0-1)
|
|
21
|
+
* @returns RGBA color string
|
|
22
|
+
*/
|
|
23
|
+
export declare function createRgbaColor(rgb: [number, number, number], opacity: number): string;
|
|
24
|
+
/**
|
|
25
|
+
* Calculates opacity based on a ratio (0-1)
|
|
26
|
+
* @param ratio - Ratio value (0-1)
|
|
27
|
+
* @param minOpacity - Minimum opacity (default: 0.1)
|
|
28
|
+
* @param maxOpacity - Maximum opacity (default: 1)
|
|
29
|
+
* @returns Opacity value (0-1)
|
|
30
|
+
*/
|
|
31
|
+
export declare function ratioToOpacity(ratio: number, minOpacity?: number, maxOpacity?: number): number;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progress Utilities
|
|
3
|
+
*
|
|
4
|
+
* Helper functions for progress-related calculations
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Validates and clamps a progress value to ensure it's within valid range
|
|
8
|
+
* @param value - Raw progress value
|
|
9
|
+
* @returns Clamped progress value (0-100)
|
|
10
|
+
*/
|
|
11
|
+
export declare function normalizeProgress(value: number): number;
|
|
12
|
+
/**
|
|
13
|
+
* Formats a progress value as a percentage string
|
|
14
|
+
* @param value - Progress value (0-100)
|
|
15
|
+
* @param decimals - Number of decimal places (default: 0)
|
|
16
|
+
* @returns Formatted percentage string
|
|
17
|
+
*/
|
|
18
|
+
export declare function formatPercentage(value: number, decimals?: number): string;
|
|
19
|
+
/**
|
|
20
|
+
* Calculates the percentage completed of a multi-step process
|
|
21
|
+
* @param currentStep - Current step (1-indexed)
|
|
22
|
+
* @param totalSteps - Total number of steps
|
|
23
|
+
* @returns Percentage (0-100)
|
|
24
|
+
*/
|
|
25
|
+
export declare function calculateStepProgress(currentStep: number, totalSteps: number): number;
|
|
26
|
+
/**
|
|
27
|
+
* Checks if progress is complete
|
|
28
|
+
* @param value - Progress value (0-100)
|
|
29
|
+
* @returns True if progress is 100%
|
|
30
|
+
*/
|
|
31
|
+
export declare function isComplete(value: number): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Checks if progress has started
|
|
34
|
+
* @param value - Progress value (0-100)
|
|
35
|
+
* @returns True if progress > 0%
|
|
36
|
+
*/
|
|
37
|
+
export declare function hasStarted(value: number): boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Math Utilities Index
|
|
3
|
+
*/
|
|
4
|
+
export { clamp, calculatePercentage, roundTo, calculateGridItemWidth, isInRange, lerp, mapRange, } from './CalculationUtils';
|
|
5
|
+
export { normalizeProgress, formatPercentage, calculateStepProgress, isComplete, hasStarted, } from './ProgressUtils';
|
|
6
|
+
export { intensityToOpacity, createRgbaColor, ratioToOpacity, } from './OpacityUtils';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.27.0",
|
|
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",
|
|
@@ -31,14 +31,98 @@ export { NavigationCleanupManager } from "./utils/NavigationCleanup";
|
|
|
31
31
|
export type { NavigationCleanup } from "./utils/NavigationCleanup";
|
|
32
32
|
|
|
33
33
|
// Navigation Utilities
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* AppNavigation - Global navigation utility for programmatic navigation outside React components.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* import { AppNavigation } from '@umituz/react-native-design-system/molecules';
|
|
41
|
+
*
|
|
42
|
+
* // Navigate from a non-React context
|
|
43
|
+
* AppNavigation.navigate('ScreenName', { param: 'value' });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
34
46
|
export { AppNavigation } from "./utils/AppNavigation";
|
|
47
|
+
|
|
35
48
|
export { TabLabel, type TabLabelProps } from "./components/TabLabel";
|
|
36
49
|
export * from "./components/NavigationHeader";
|
|
37
50
|
export { useTabBarStyles, type TabBarConfig } from "./hooks/useTabBarStyles";
|
|
38
51
|
export { useTabConfig, type UseTabConfigProps } from "./hooks/useTabConfig";
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* useAppNavigation - Standard navigation hook for all React Native packages.
|
|
55
|
+
*
|
|
56
|
+
* Provides a clean, type-safe navigation API that wraps React Navigation.
|
|
57
|
+
* Use this hook instead of @react-navigation/native's useNavigation for consistency.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* import { useAppNavigation } from '@umituz/react-native-design-system/molecules';
|
|
62
|
+
*
|
|
63
|
+
* function MyScreen() {
|
|
64
|
+
* const navigation = useAppNavigation();
|
|
65
|
+
*
|
|
66
|
+
* return (
|
|
67
|
+
* <Button onPress={() => navigation.navigate('Details', { id: 123 })}>
|
|
68
|
+
* Go to Details
|
|
69
|
+
* </Button>
|
|
70
|
+
* );
|
|
71
|
+
* }
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
39
74
|
export { useAppNavigation } from "./hooks/useAppNavigation";
|
|
75
|
+
export type { AppNavigationResult } from "./hooks/useAppNavigation";
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* useAppRoute - Hook to access current route parameters.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* import { useAppRoute } from '@umituz/react-native-design-system/molecules';
|
|
83
|
+
*
|
|
84
|
+
* function DetailsScreen() {
|
|
85
|
+
* const route = useAppRoute<{ id: number }>();
|
|
86
|
+
* const id = route.params?.id;
|
|
87
|
+
* }
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
40
90
|
export { useAppRoute, type RouteProp } from "./hooks/useAppRoute";
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* useAppFocusEffect - Run effects when screen comes into focus.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* import { useAppFocusEffect } from '@umituz/react-native-design-system/molecules';
|
|
98
|
+
* import { useCallback } from 'react';
|
|
99
|
+
*
|
|
100
|
+
* function ProfileScreen() {
|
|
101
|
+
* useAppFocusEffect(
|
|
102
|
+
* useCallback(() => {
|
|
103
|
+
* console.log('Screen focused');
|
|
104
|
+
* return () => console.log('Screen unfocused');
|
|
105
|
+
* }, [])
|
|
106
|
+
* );
|
|
107
|
+
* }
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
41
110
|
export { useAppFocusEffect } from "./hooks/useAppFocusEffect";
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* useAppIsFocused - Check if current screen is focused.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* import { useAppIsFocused } from '@umituz/react-native-design-system/molecules';
|
|
118
|
+
*
|
|
119
|
+
* function VideoPlayer() {
|
|
120
|
+
* const isFocused = useAppIsFocused();
|
|
121
|
+
*
|
|
122
|
+
* return <Video playing={isFocused} />;
|
|
123
|
+
* }
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
42
126
|
export { useAppIsFocused } from "./hooks/useAppIsFocused";
|
|
43
127
|
|
|
44
128
|
// Screen Options
|