@umituz/react-native-design-system 2.3.3 → 2.3.6
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.6",
|
|
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",
|
|
@@ -117,4 +117,4 @@
|
|
|
117
117
|
"README.md",
|
|
118
118
|
"LICENSE"
|
|
119
119
|
]
|
|
120
|
-
}
|
|
120
|
+
}
|
|
@@ -60,6 +60,10 @@ export interface AtomicInputProps {
|
|
|
60
60
|
onBlur?: () => void;
|
|
61
61
|
/** Focus callback */
|
|
62
62
|
onFocus?: () => void;
|
|
63
|
+
/** Multiline input support */
|
|
64
|
+
multiline?: boolean;
|
|
65
|
+
/** Number of lines for multiline input */
|
|
66
|
+
numberOfLines?: number;
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
/**
|
|
@@ -99,6 +103,8 @@ export const AtomicInput: React.FC<AtomicInputProps> = ({
|
|
|
99
103
|
testID,
|
|
100
104
|
onBlur,
|
|
101
105
|
onFocus,
|
|
106
|
+
multiline = false,
|
|
107
|
+
numberOfLines,
|
|
102
108
|
}) => {
|
|
103
109
|
const tokens = useAppDesignTokens();
|
|
104
110
|
|
|
@@ -202,6 +208,8 @@ export const AtomicInput: React.FC<AtomicInputProps> = ({
|
|
|
202
208
|
autoCapitalize={autoCapitalize}
|
|
203
209
|
autoCorrect={autoCorrect}
|
|
204
210
|
editable={!isDisabled}
|
|
211
|
+
multiline={multiline}
|
|
212
|
+
numberOfLines={numberOfLines}
|
|
205
213
|
style={textInputStyle}
|
|
206
214
|
onBlur={() => {
|
|
207
215
|
setIsFocused(false);
|
package/src/index.ts
CHANGED
|
@@ -90,9 +90,6 @@ export {
|
|
|
90
90
|
|
|
91
91
|
export {
|
|
92
92
|
useResponsive,
|
|
93
|
-
getScreenDimensions,
|
|
94
|
-
isSmallPhone,
|
|
95
|
-
isTablet,
|
|
96
93
|
getResponsiveLogoSize,
|
|
97
94
|
getResponsiveInputHeight,
|
|
98
95
|
getResponsiveHorizontalPadding,
|
|
@@ -112,20 +109,71 @@ export {
|
|
|
112
109
|
getResponsiveGridColumns,
|
|
113
110
|
getResponsiveMaxWidth,
|
|
114
111
|
getResponsiveFontSize,
|
|
115
|
-
isLandscape,
|
|
116
|
-
getDeviceType,
|
|
117
112
|
getMinTouchTarget,
|
|
118
|
-
getSpacingMultiplier,
|
|
119
113
|
IOS_HIG,
|
|
120
114
|
PLATFORM_CONSTANTS,
|
|
121
115
|
isValidTouchTarget,
|
|
122
|
-
|
|
116
|
+
DEVICE_BREAKPOINTS,
|
|
123
117
|
type ResponsiveModalLayout,
|
|
124
118
|
type ResponsiveBottomSheetLayout,
|
|
125
119
|
type ResponsiveDialogLayout,
|
|
126
120
|
type UseResponsiveReturn,
|
|
127
121
|
} from './responsive';
|
|
128
122
|
|
|
123
|
+
// =============================================================================
|
|
124
|
+
// DEVICE EXPORTS
|
|
125
|
+
// =============================================================================
|
|
126
|
+
|
|
127
|
+
export {
|
|
128
|
+
// Device detection
|
|
129
|
+
DeviceType,
|
|
130
|
+
getScreenDimensions,
|
|
131
|
+
isSmallPhone,
|
|
132
|
+
isTablet,
|
|
133
|
+
isLandscape,
|
|
134
|
+
getDeviceType,
|
|
135
|
+
getSpacingMultiplier,
|
|
136
|
+
// iPad detection
|
|
137
|
+
isIPad,
|
|
138
|
+
isIPadMini,
|
|
139
|
+
isIPadPro,
|
|
140
|
+
isIPadLandscape,
|
|
141
|
+
IPAD_BREAKPOINTS,
|
|
142
|
+
TOUCH_TARGETS,
|
|
143
|
+
CONTENT_WIDTH_CONSTRAINTS,
|
|
144
|
+
IPAD_LAYOUT_CONFIG,
|
|
145
|
+
// iPad utilities
|
|
146
|
+
getContentMaxWidth,
|
|
147
|
+
getIPadGridColumns,
|
|
148
|
+
getTouchTargetSize,
|
|
149
|
+
getIPadScreenPadding,
|
|
150
|
+
getIPadFontScale,
|
|
151
|
+
getIPadLayoutInfo,
|
|
152
|
+
getIPadModalDimensions,
|
|
153
|
+
getPaywallDimensions,
|
|
154
|
+
type IPadLayoutInfo,
|
|
155
|
+
type ModalDimensions,
|
|
156
|
+
type PaywallDimensions,
|
|
157
|
+
// Device info
|
|
158
|
+
DEVICE_CONSTANTS,
|
|
159
|
+
DeviceUtils,
|
|
160
|
+
DeviceTypeUtils,
|
|
161
|
+
DeviceMemoryUtils,
|
|
162
|
+
DeviceService,
|
|
163
|
+
UserFriendlyIdService,
|
|
164
|
+
PersistentDeviceIdService,
|
|
165
|
+
useDeviceInfo,
|
|
166
|
+
useDeviceCapabilities,
|
|
167
|
+
useDeviceId,
|
|
168
|
+
useAnonymousUser,
|
|
169
|
+
getAnonymousUserId,
|
|
170
|
+
type DeviceInfo,
|
|
171
|
+
type ApplicationInfo,
|
|
172
|
+
type SystemInfo,
|
|
173
|
+
type AnonymousUser,
|
|
174
|
+
type UseAnonymousUserOptions,
|
|
175
|
+
} from './device';
|
|
176
|
+
|
|
129
177
|
// =============================================================================
|
|
130
178
|
// ATOMS EXPORTS
|
|
131
179
|
// =============================================================================
|
|
@@ -24,10 +24,13 @@
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
import React, { useMemo } from 'react';
|
|
27
|
-
import { View, ScrollView, StyleSheet, type ViewStyle } from 'react-native';
|
|
28
|
-
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
27
|
+
import { View, ScrollView, StyleSheet, type ViewStyle, RefreshControlProps } from 'react-native';
|
|
28
|
+
import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
29
29
|
import type { Edge } from 'react-native-safe-area-context';
|
|
30
30
|
import { useAppDesignTokens } from '../theme';
|
|
31
|
+
import { useResponsive } from '../responsive/useResponsive';
|
|
32
|
+
import { getResponsiveMaxWidth } from '../responsive/responsiveSizing';
|
|
33
|
+
import { getResponsiveHorizontalPadding } from '../responsive/responsiveLayout';
|
|
31
34
|
|
|
32
35
|
/**
|
|
33
36
|
* NOTE: This component now works in conjunction with the SafeAreaProvider
|
|
@@ -124,6 +127,20 @@ export interface ScreenLayoutProps {
|
|
|
124
127
|
*/
|
|
125
128
|
accessible?: boolean;
|
|
126
129
|
|
|
130
|
+
/**
|
|
131
|
+
* Enable responsive content width and centering (default: true)
|
|
132
|
+
*/
|
|
133
|
+
responsiveEnabled?: boolean;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Maximum content width override
|
|
137
|
+
*/
|
|
138
|
+
maxWidth?: number;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* RefreshControl component for pull-to-refresh
|
|
142
|
+
*/
|
|
143
|
+
refreshControl?: React.ReactElement<RefreshControlProps>;
|
|
127
144
|
}
|
|
128
145
|
|
|
129
146
|
export const ScreenLayout: React.FC<ScreenLayoutProps> = ({
|
|
@@ -138,25 +155,41 @@ export const ScreenLayout: React.FC<ScreenLayoutProps> = ({
|
|
|
138
155
|
testID,
|
|
139
156
|
hideScrollIndicator = false,
|
|
140
157
|
keyboardAvoiding = false,
|
|
158
|
+
responsiveEnabled = true,
|
|
159
|
+
maxWidth,
|
|
160
|
+
refreshControl,
|
|
141
161
|
}) => {
|
|
142
162
|
// Automatically uses current theme from global store
|
|
143
163
|
const tokens = useAppDesignTokens();
|
|
164
|
+
const { isTabletDevice } = useResponsive();
|
|
165
|
+
const insets = useSafeAreaInsets();
|
|
166
|
+
|
|
167
|
+
const finalMaxWidth = maxWidth || (responsiveEnabled ? getResponsiveMaxWidth() : undefined);
|
|
168
|
+
const horizontalPadding = responsiveEnabled ? getResponsiveHorizontalPadding(tokens.spacing.md, insets) : tokens.spacing.md;
|
|
169
|
+
|
|
144
170
|
const styles = useMemo(() => StyleSheet.create({
|
|
145
171
|
container: {
|
|
146
172
|
flex: 1,
|
|
147
173
|
},
|
|
174
|
+
responsiveWrapper: {
|
|
175
|
+
flex: 1,
|
|
176
|
+
width: '100%',
|
|
177
|
+
maxWidth: finalMaxWidth,
|
|
178
|
+
alignSelf: 'center',
|
|
179
|
+
},
|
|
148
180
|
content: {
|
|
149
181
|
flex: 1,
|
|
182
|
+
paddingHorizontal: horizontalPadding,
|
|
150
183
|
},
|
|
151
184
|
scrollView: {
|
|
152
185
|
flex: 1,
|
|
153
186
|
},
|
|
154
187
|
scrollContent: {
|
|
155
188
|
flexGrow: 1,
|
|
156
|
-
paddingHorizontal:
|
|
189
|
+
paddingHorizontal: horizontalPadding,
|
|
157
190
|
paddingBottom: tokens.spacing.lg,
|
|
158
191
|
},
|
|
159
|
-
}), [tokens]);
|
|
192
|
+
}), [tokens, finalMaxWidth, horizontalPadding]);
|
|
160
193
|
|
|
161
194
|
const bgColor = backgroundColor || tokens.colors.backgroundPrimary;
|
|
162
195
|
|
|
@@ -168,11 +201,13 @@ export const ScreenLayout: React.FC<ScreenLayoutProps> = ({
|
|
|
168
201
|
edges={edges}
|
|
169
202
|
testID={testID}
|
|
170
203
|
>
|
|
171
|
-
{
|
|
172
|
-
|
|
173
|
-
{
|
|
204
|
+
<View style={styles.responsiveWrapper}>
|
|
205
|
+
{header}
|
|
206
|
+
<View style={[styles.content, contentContainerStyle]}>
|
|
207
|
+
{children}
|
|
208
|
+
</View>
|
|
209
|
+
{footer}
|
|
174
210
|
</View>
|
|
175
|
-
{footer}
|
|
176
211
|
</SafeAreaView>
|
|
177
212
|
);
|
|
178
213
|
}
|
|
@@ -184,16 +219,19 @@ export const ScreenLayout: React.FC<ScreenLayoutProps> = ({
|
|
|
184
219
|
edges={edges}
|
|
185
220
|
testID={testID}
|
|
186
221
|
>
|
|
187
|
-
{
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
222
|
+
<View style={styles.responsiveWrapper}>
|
|
223
|
+
{header}
|
|
224
|
+
<ScrollView
|
|
225
|
+
style={styles.scrollView}
|
|
226
|
+
contentContainerStyle={[styles.scrollContent, contentContainerStyle]}
|
|
227
|
+
showsVerticalScrollIndicator={!hideScrollIndicator}
|
|
228
|
+
keyboardShouldPersistTaps={keyboardAvoiding ? 'handled' : 'never'}
|
|
229
|
+
refreshControl={refreshControl}
|
|
230
|
+
>
|
|
231
|
+
{children}
|
|
232
|
+
</ScrollView>
|
|
233
|
+
{footer}
|
|
234
|
+
</View>
|
|
197
235
|
</SafeAreaView>
|
|
198
236
|
);
|
|
199
237
|
};
|
package/src/responsive/index.ts
CHANGED
|
@@ -38,36 +38,6 @@ export {
|
|
|
38
38
|
MODAL_CONFIG,
|
|
39
39
|
} from './responsive';
|
|
40
40
|
|
|
41
|
-
// Re-export from device for backward compatibility
|
|
42
|
-
export {
|
|
43
|
-
DeviceType,
|
|
44
|
-
getScreenDimensions,
|
|
45
|
-
isSmallPhone,
|
|
46
|
-
isTablet,
|
|
47
|
-
isLandscape,
|
|
48
|
-
getDeviceType,
|
|
49
|
-
getSpacingMultiplier,
|
|
50
|
-
isIPad,
|
|
51
|
-
isIPadMini,
|
|
52
|
-
isIPadPro,
|
|
53
|
-
isIPadLandscape,
|
|
54
|
-
IPAD_BREAKPOINTS,
|
|
55
|
-
TOUCH_TARGETS,
|
|
56
|
-
CONTENT_WIDTH_CONSTRAINTS,
|
|
57
|
-
IPAD_LAYOUT_CONFIG,
|
|
58
|
-
getContentMaxWidth,
|
|
59
|
-
getIPadGridColumns,
|
|
60
|
-
getTouchTargetSize,
|
|
61
|
-
getIPadScreenPadding,
|
|
62
|
-
getIPadFontScale,
|
|
63
|
-
getIPadLayoutInfo,
|
|
64
|
-
type IPadLayoutInfo,
|
|
65
|
-
getIPadModalDimensions,
|
|
66
|
-
getPaywallDimensions,
|
|
67
|
-
type ModalDimensions,
|
|
68
|
-
type PaywallDimensions,
|
|
69
|
-
} from '../device/detection';
|
|
70
|
-
|
|
71
41
|
// Platform constants
|
|
72
42
|
export {
|
|
73
43
|
IOS_HIG,
|
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Responsive Design Utilities
|
|
3
3
|
*
|
|
4
|
-
* Centralized responsive sizing and spacing utilities
|
|
5
|
-
* Apple App Store rejection due to layout issues on different devices.
|
|
6
|
-
*
|
|
7
|
-
* This is the main export file that imports from specialized modules.
|
|
4
|
+
* Centralized responsive sizing and spacing utilities.
|
|
8
5
|
*/
|
|
9
6
|
|
|
10
|
-
// Device detection (re-exported from device module)
|
|
11
|
-
export {
|
|
12
|
-
getScreenDimensions,
|
|
13
|
-
isSmallPhone,
|
|
14
|
-
isTablet,
|
|
15
|
-
isLandscape,
|
|
16
|
-
getDeviceType,
|
|
17
|
-
DeviceType,
|
|
18
|
-
} from '../device/detection';
|
|
19
|
-
|
|
20
7
|
// Responsive sizing
|
|
21
8
|
export {
|
|
22
9
|
getResponsiveLogoSize,
|
|
@@ -53,14 +40,6 @@ export {
|
|
|
53
40
|
type ResponsiveDialogLayout,
|
|
54
41
|
} from './responsiveModal';
|
|
55
42
|
|
|
56
|
-
// Platform constants
|
|
57
|
-
export {
|
|
58
|
-
IOS_HIG,
|
|
59
|
-
PLATFORM_CONSTANTS,
|
|
60
|
-
isValidTouchTarget,
|
|
61
|
-
getMinTouchTarget,
|
|
62
|
-
} from './platformConstants';
|
|
63
|
-
|
|
64
43
|
// Configuration
|
|
65
44
|
export {
|
|
66
45
|
DEVICE_BREAKPOINTS,
|
|
@@ -72,6 +51,3 @@ export {
|
|
|
72
51
|
VALIDATION_CONSTRAINTS,
|
|
73
52
|
MODAL_CONFIG,
|
|
74
53
|
} from './config';
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
@@ -28,17 +28,19 @@ import {
|
|
|
28
28
|
getResponsiveGridColumns,
|
|
29
29
|
getResponsiveMaxWidth,
|
|
30
30
|
getResponsiveFontSize,
|
|
31
|
+
type ResponsiveModalLayout,
|
|
32
|
+
type ResponsiveBottomSheetLayout,
|
|
33
|
+
type ResponsiveDialogLayout,
|
|
34
|
+
} from './responsive';
|
|
35
|
+
import {
|
|
31
36
|
isSmallPhone,
|
|
32
37
|
isTablet,
|
|
33
38
|
isLandscape,
|
|
34
39
|
getDeviceType,
|
|
35
|
-
getMinTouchTarget,
|
|
36
40
|
DeviceType,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} from './responsive';
|
|
41
|
-
import { getSpacingMultiplier } from '../device/detection';
|
|
41
|
+
getSpacingMultiplier,
|
|
42
|
+
} from '../device/detection';
|
|
43
|
+
import { getMinTouchTarget } from './platformConstants';
|
|
42
44
|
|
|
43
45
|
export interface UseResponsiveReturn {
|
|
44
46
|
// Device info
|