@umituz/react-native-design-system 2.6.73 → 2.6.74
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/package.json +1 -4
- package/src/atoms/AtomicText.tsx +2 -7
- package/src/atoms/index.ts +1 -1
- package/src/device/detection/deviceDetection.ts +35 -93
- package/src/exports/molecules.ts +1 -1
- package/src/molecules/bottom-sheet/index.ts +1 -1
- package/src/theme/infrastructure/providers/DesignSystemProvider.tsx +1 -3
- package/src/atoms/AtomicButton.tsx +0 -7
- package/src/molecules/bottom-sheet/components/SafeBottomSheetModalProvider.tsx +0 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.74",
|
|
4
4
|
"description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive and safe area utilities",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -81,9 +81,6 @@
|
|
|
81
81
|
"@react-navigation/native": {
|
|
82
82
|
"optional": true
|
|
83
83
|
},
|
|
84
|
-
"expo-device": {
|
|
85
|
-
"optional": true
|
|
86
|
-
},
|
|
87
84
|
"expo-application": {
|
|
88
85
|
"optional": true
|
|
89
86
|
}
|
package/src/atoms/AtomicText.tsx
CHANGED
|
@@ -4,8 +4,7 @@ import { useAppDesignTokens } from '../theme';
|
|
|
4
4
|
import { getTextColor, type TextStyleVariant, type ColorVariant } from '../typography';
|
|
5
5
|
|
|
6
6
|
export interface AtomicTextProps extends Omit<TextProps, 'style'> {
|
|
7
|
-
|
|
8
|
-
variant?: TextStyleVariant;
|
|
7
|
+
|
|
9
8
|
|
|
10
9
|
/** Typographic style variant from tokens */
|
|
11
10
|
type?: TextStyleVariant;
|
|
@@ -43,7 +42,6 @@ export interface AtomicTextProps extends Omit<TextProps, 'style'> {
|
|
|
43
42
|
* ✅ SOLID, DRY, KISS
|
|
44
43
|
*/
|
|
45
44
|
export const AtomicText = ({
|
|
46
|
-
variant,
|
|
47
45
|
type = 'bodyMedium',
|
|
48
46
|
color = 'textPrimary',
|
|
49
47
|
align,
|
|
@@ -57,11 +55,8 @@ export const AtomicText = ({
|
|
|
57
55
|
}: AtomicTextProps) => {
|
|
58
56
|
const tokens = useAppDesignTokens();
|
|
59
57
|
|
|
60
|
-
// Support both 'variant' and 'type' props for backward compatibility
|
|
61
|
-
const textType = variant || type;
|
|
62
|
-
|
|
63
58
|
// Get typography style from tokens
|
|
64
|
-
const typographyStyle = tokens.typography[
|
|
59
|
+
const typographyStyle = tokens.typography[type] as TextStyle & { responsiveFontSize?: number };
|
|
65
60
|
|
|
66
61
|
// Use responsive font size if available
|
|
67
62
|
const fontSize = typographyStyle?.responsiveFontSize || typographyStyle?.fontSize;
|
package/src/atoms/index.ts
CHANGED
|
@@ -11,37 +11,10 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { Dimensions } from 'react-native';
|
|
14
|
+
import * as Device from 'expo-device';
|
|
14
15
|
import { DEVICE_BREAKPOINTS, LAYOUT_CONSTANTS } from '../../responsive/config';
|
|
15
16
|
import { validateScreenDimensions } from '../../responsive/validation';
|
|
16
17
|
|
|
17
|
-
// Safely try to import expo-device
|
|
18
|
-
let Device: any = null;
|
|
19
|
-
let ExpoDeviceType: any = null;
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
23
|
-
const ExpoDevice = require('expo-device');
|
|
24
|
-
Device = ExpoDevice;
|
|
25
|
-
ExpoDeviceType = ExpoDevice.DeviceType;
|
|
26
|
-
} catch {
|
|
27
|
-
// Fallback if expo-device is not available
|
|
28
|
-
console.warn('[Design System] expo-device not found, using screen dimensions for device detection');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Helper function for device detection with fallback
|
|
33
|
-
*/
|
|
34
|
-
const withDeviceDetectionFallback = <T>(
|
|
35
|
-
operation: () => T,
|
|
36
|
-
fallback: T
|
|
37
|
-
): T => {
|
|
38
|
-
try {
|
|
39
|
-
return operation();
|
|
40
|
-
} catch {
|
|
41
|
-
return fallback;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
18
|
/**
|
|
46
19
|
* Device type enum for conditional rendering
|
|
47
20
|
* Used for fine-grained phone size distinctions
|
|
@@ -72,10 +45,7 @@ export const getScreenDimensions = () => {
|
|
|
72
45
|
* Uses expo-device for accurate system-level detection
|
|
73
46
|
*/
|
|
74
47
|
export const isTablet = (): boolean => {
|
|
75
|
-
return
|
|
76
|
-
() => Device.deviceType === ExpoDeviceType.TABLET,
|
|
77
|
-
false
|
|
78
|
-
);
|
|
48
|
+
return Device.deviceType === Device.DeviceType.TABLET;
|
|
79
49
|
};
|
|
80
50
|
|
|
81
51
|
/**
|
|
@@ -83,10 +53,7 @@ export const isTablet = (): boolean => {
|
|
|
83
53
|
* Uses expo-device for accurate system-level detection
|
|
84
54
|
*/
|
|
85
55
|
export const isPhone = (): boolean => {
|
|
86
|
-
return
|
|
87
|
-
() => Device.deviceType === ExpoDeviceType.PHONE,
|
|
88
|
-
true
|
|
89
|
-
);
|
|
56
|
+
return Device.deviceType === Device.DeviceType.PHONE;
|
|
90
57
|
};
|
|
91
58
|
|
|
92
59
|
/**
|
|
@@ -94,14 +61,9 @@ export const isPhone = (): boolean => {
|
|
|
94
61
|
* Uses width breakpoint within phone category
|
|
95
62
|
*/
|
|
96
63
|
export const isSmallPhone = (): boolean => {
|
|
97
|
-
return
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const { width } = getScreenDimensions();
|
|
101
|
-
return width <= DEVICE_BREAKPOINTS.SMALL_PHONE;
|
|
102
|
-
},
|
|
103
|
-
false
|
|
104
|
-
);
|
|
64
|
+
if (!isPhone()) return false;
|
|
65
|
+
const { width } = getScreenDimensions();
|
|
66
|
+
return width <= DEVICE_BREAKPOINTS.SMALL_PHONE;
|
|
105
67
|
};
|
|
106
68
|
|
|
107
69
|
/**
|
|
@@ -109,27 +71,17 @@ export const isSmallPhone = (): boolean => {
|
|
|
109
71
|
* Uses width breakpoint within phone category
|
|
110
72
|
*/
|
|
111
73
|
export const isLargePhone = (): boolean => {
|
|
112
|
-
return
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const { width } = getScreenDimensions();
|
|
116
|
-
return width >= DEVICE_BREAKPOINTS.MEDIUM_PHONE;
|
|
117
|
-
},
|
|
118
|
-
false
|
|
119
|
-
);
|
|
74
|
+
if (!isPhone()) return false;
|
|
75
|
+
const { width } = getScreenDimensions();
|
|
76
|
+
return width >= DEVICE_BREAKPOINTS.MEDIUM_PHONE;
|
|
120
77
|
};
|
|
121
78
|
|
|
122
79
|
/**
|
|
123
80
|
* Check if device is in landscape mode
|
|
124
81
|
*/
|
|
125
82
|
export const isLandscape = (): boolean => {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const { width, height } = getScreenDimensions();
|
|
129
|
-
return width > height;
|
|
130
|
-
},
|
|
131
|
-
false
|
|
132
|
-
);
|
|
83
|
+
const { width, height } = getScreenDimensions();
|
|
84
|
+
return width > height;
|
|
133
85
|
};
|
|
134
86
|
|
|
135
87
|
/**
|
|
@@ -137,44 +89,34 @@ export const isLandscape = (): boolean => {
|
|
|
137
89
|
* Uses expo-device for PHONE vs TABLET, width for phone size variants
|
|
138
90
|
*/
|
|
139
91
|
export const getDeviceType = (): DeviceType => {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
return DeviceType.LARGE_PHONE;
|
|
157
|
-
},
|
|
158
|
-
DeviceType.MEDIUM_PHONE
|
|
159
|
-
);
|
|
92
|
+
// Use expo-device for primary detection
|
|
93
|
+
if (isTablet()) {
|
|
94
|
+
return DeviceType.TABLET;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// For phones, use width for size variants
|
|
98
|
+
const { width } = getScreenDimensions();
|
|
99
|
+
|
|
100
|
+
if (width <= DEVICE_BREAKPOINTS.SMALL_PHONE) {
|
|
101
|
+
return DeviceType.SMALL_PHONE;
|
|
102
|
+
} else if (width <= DEVICE_BREAKPOINTS.MEDIUM_PHONE) {
|
|
103
|
+
return DeviceType.MEDIUM_PHONE;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return DeviceType.LARGE_PHONE;
|
|
160
107
|
};
|
|
161
108
|
|
|
162
109
|
/**
|
|
163
110
|
* Responsive spacing multiplier based on device type
|
|
164
111
|
*/
|
|
165
112
|
export const getSpacingMultiplier = (): number => {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
return LAYOUT_CONSTANTS.SPACING_MULTIPLIER_STANDARD;
|
|
177
|
-
},
|
|
178
|
-
LAYOUT_CONSTANTS.SPACING_MULTIPLIER_STANDARD
|
|
179
|
-
);
|
|
113
|
+
if (isTablet()) {
|
|
114
|
+
return LAYOUT_CONSTANTS.SPACING_MULTIPLIER_TABLET;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (isSmallPhone()) {
|
|
118
|
+
return LAYOUT_CONSTANTS.SPACING_MULTIPLIER_SMALL;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return LAYOUT_CONSTANTS.SPACING_MULTIPLIER_STANDARD;
|
|
180
122
|
};
|
package/src/exports/molecules.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './components/BottomSheet';
|
|
2
2
|
export * from './components/BottomSheetModal';
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
export * from './components/filter/FilterBottomSheet';
|
|
5
5
|
export * from './components/filter/FilterSheet';
|
|
6
6
|
export * from './hooks/useBottomSheet';
|
|
@@ -7,7 +7,7 @@ import { useDesignSystemTheme } from '../globalThemeStore';
|
|
|
7
7
|
import type { CustomThemeColors } from '../../core/CustomColors';
|
|
8
8
|
import { SplashScreen } from '../../../molecules/splash';
|
|
9
9
|
import type { SplashScreenProps } from '../../../molecules/splash/types';
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
|
|
12
12
|
declare const __DEV__: boolean;
|
|
13
13
|
|
|
@@ -163,9 +163,7 @@ export const DesignSystemProvider: React.FC<DesignSystemProviderProps> = ({
|
|
|
163
163
|
return (
|
|
164
164
|
<GestureHandlerRootView style={{ flex: 1 }}>
|
|
165
165
|
<SafeAreaProvider initialMetrics={initialWindowMetrics}>
|
|
166
|
-
<SafeBottomSheetModalProvider>
|
|
167
166
|
{renderContent()}
|
|
168
|
-
</SafeBottomSheetModalProvider>
|
|
169
167
|
</SafeAreaProvider>
|
|
170
168
|
</GestureHandlerRootView>
|
|
171
169
|
);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
export interface SafeBottomSheetModalProviderProps {
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* SafeBottomSheetModalProvider
|
|
9
|
-
*
|
|
10
|
-
* Simple wrapper for backward compatibility.
|
|
11
|
-
* No longer uses @gorhom/bottom-sheet provider.
|
|
12
|
-
*/
|
|
13
|
-
export const SafeBottomSheetModalProvider = ({ children }: SafeBottomSheetModalProviderProps) => {
|
|
14
|
-
return <>{children}</>;
|
|
15
|
-
};
|