@umituz/react-native-design-system 2.6.13 → 2.6.15

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.6.13",
3
+ "version": "2.6.15",
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",
@@ -1,20 +1,20 @@
1
1
  /**
2
2
  * iPad Device Detection Utilities
3
+ *
4
+ * Uses expo-device for system-level tablet detection,
5
+ * then uses screen dimensions for iPad-specific sub-categories.
3
6
  */
4
7
 
5
- import { Dimensions, Platform } from 'react-native';
6
- import { DEVICE_BREAKPOINTS } from '../../responsive/config';
8
+ import { Dimensions } from 'react-native';
7
9
  import { IPAD_BREAKPOINTS } from './iPadBreakpoints';
10
+ import { isTablet, isLandscape } from './deviceDetection';
8
11
 
9
12
  /**
10
- * Detect if the current device is an iPad
13
+ * Detect if the current device is an iPad (or Android tablet)
14
+ * Uses expo-device for accurate system-level detection
11
15
  */
12
16
  export function isIPad(): boolean {
13
- if (Platform.OS !== 'ios') return false;
14
-
15
- const { width, height } = Dimensions.get('window');
16
- const minDimension = Math.min(width, height);
17
- return minDimension >= DEVICE_BREAKPOINTS.SMALL_TABLET;
17
+ return isTablet();
18
18
  }
19
19
 
20
20
  /**
@@ -40,9 +40,9 @@ export function isIPadPro(): boolean {
40
40
  }
41
41
 
42
42
  /**
43
- * Check if device is in landscape orientation
43
+ * Check if tablet device is in landscape orientation
44
+ * Uses shared isLandscape detection for consistency
44
45
  */
45
46
  export function isIPadLandscape(): boolean {
46
- const { width, height } = Dimensions.get('window');
47
- return width > height;
47
+ return isLandscape();
48
48
  }
@@ -19,7 +19,9 @@ export {
19
19
  export {
20
20
  DeviceType,
21
21
  getScreenDimensions,
22
+ isPhone,
22
23
  isSmallPhone,
24
+ isLargePhone,
23
25
  isTablet,
24
26
  isLandscape,
25
27
  getDeviceType,
@@ -20,7 +20,9 @@ export {
20
20
  // Device type detection
21
21
  DeviceType,
22
22
  getScreenDimensions,
23
+ isPhone,
23
24
  isSmallPhone,
25
+ isLargePhone,
24
26
  isTablet,
25
27
  isLandscape,
26
28
  getDeviceType,
package/src/index.ts CHANGED
@@ -125,7 +125,9 @@ export {
125
125
  // Device detection
126
126
  DeviceType,
127
127
  getScreenDimensions,
128
+ isPhone,
128
129
  isSmallPhone,
130
+ isLargePhone,
129
131
  isTablet,
130
132
  isLandscape,
131
133
  getDeviceType,
@@ -3,8 +3,8 @@
3
3
  * Responsive grid sizing and column calculations
4
4
  */
5
5
 
6
- import { getScreenDimensions } from '../device/detection';
7
- import { DEVICE_BREAKPOINTS, GRID_CONFIG } from './config';
6
+ import { getScreenDimensions, isTablet } from '../device/detection';
7
+ import { GRID_CONFIG } from './config';
8
8
  import { validateNumber } from './validation';
9
9
 
10
10
  /**
@@ -23,8 +23,8 @@ export const getResponsiveGridColumns = (
23
23
  const validatedMobile = validateNumber(mobileColumns, 'mobileColumns', 1, 20);
24
24
  const validatedTablet = validateNumber(tabletColumns, 'tabletColumns', 1, 20);
25
25
 
26
- const { width } = getScreenDimensions();
27
- return width >= DEVICE_BREAKPOINTS.TABLET ? validatedTablet : validatedMobile;
26
+ const isTabletDevice = isTablet();
27
+ return isTabletDevice ? validatedTablet : validatedMobile;
28
28
  } catch {
29
29
  return 2;
30
30
  }
@@ -3,10 +3,16 @@
3
3
  * Layout utilities for positioning and spacing.
4
4
  */
5
5
 
6
- import { getScreenDimensions } from '../device/detection';
7
- import { DEVICE_BREAKPOINTS, LAYOUT_CONSTANTS } from './config';
6
+ import { getScreenDimensions, isTablet } from '../device/detection';
7
+ import { LAYOUT_CONSTANTS } from './config';
8
8
  import { validateNumber, validateSafeAreaInsets } from './validation';
9
9
 
10
+ /**
11
+ * Check if device is tablet-sized (for responsive layouts)
12
+ * Uses expo-device based detection for accuracy
13
+ */
14
+ const checkIsTabletSize = (): boolean => isTablet();
15
+
10
16
  /**
11
17
  * Responsive horizontal padding
12
18
  */
@@ -18,10 +24,10 @@ export const getResponsiveHorizontalPadding = (
18
24
  const validatedBasePadding = validateNumber(basePadding, 'basePadding', 0, 100);
19
25
  validateSafeAreaInsets(insets);
20
26
 
21
- const { width } = getScreenDimensions();
22
27
  const { left = 0, right = 0 } = insets;
28
+ const isTabletDevice = checkIsTabletSize();
23
29
 
24
- if (width >= DEVICE_BREAKPOINTS.TABLET) {
30
+ if (isTabletDevice) {
25
31
  const tabletPadding = validatedBasePadding * 1.5;
26
32
  return Math.max(
27
33
  tabletPadding,
@@ -66,10 +72,10 @@ export const getResponsiveFABPosition = (
66
72
  ): { bottom: number; right: number } => {
67
73
  try {
68
74
  validateSafeAreaInsets(insets);
69
- const { width } = getScreenDimensions();
70
75
  const { bottom = 0, right = 0 } = insets;
76
+ const isTabletDevice = checkIsTabletSize();
71
77
 
72
- if (width >= DEVICE_BREAKPOINTS.TABLET) {
78
+ if (isTabletDevice) {
73
79
  return {
74
80
  bottom: Math.max(
75
81
  LAYOUT_CONSTANTS.FAB_BOTTOM_TABLET,
@@ -133,10 +139,10 @@ export const getResponsiveTabBarHeight = (
133
139
  ): number => {
134
140
  try {
135
141
  validateSafeAreaInsets(insets);
136
- const { width } = getScreenDimensions();
137
142
  const { bottom = 0 } = insets;
143
+ const isTabletDevice = checkIsTabletSize();
138
144
 
139
- const baseHeight = width >= DEVICE_BREAKPOINTS.SMALL_TABLET
145
+ const baseHeight = isTabletDevice
140
146
  ? TAB_BAR_CONSTANTS.BASE_HEIGHT_TABLET
141
147
  : TAB_BAR_CONSTANTS.BASE_HEIGHT_PHONE;
142
148
 
@@ -156,9 +162,8 @@ export const getResponsiveTabBarConfig = (
156
162
  ): ResponsiveTabBarConfig => {
157
163
  try {
158
164
  validateSafeAreaInsets(insets);
159
- const { width } = getScreenDimensions();
160
165
  const { bottom = 0 } = insets;
161
- const isTabletSize = width >= DEVICE_BREAKPOINTS.SMALL_TABLET;
166
+ const isTabletSize = checkIsTabletSize();
162
167
 
163
168
  const baseHeight = isTabletSize
164
169
  ? TAB_BAR_CONSTANTS.BASE_HEIGHT_TABLET
@@ -3,9 +3,8 @@
3
3
  * Modal, bottom sheet, and dialog layout utilities.
4
4
  */
5
5
 
6
- import { getScreenDimensions } from '../device/detection';
6
+ import { getScreenDimensions, isTablet } from '../device/detection';
7
7
  import {
8
- DEVICE_BREAKPOINTS,
9
8
  LAYOUT_CONSTANTS,
10
9
  HEIGHT_THRESHOLDS,
11
10
  SIZE_CONSTRAINTS,
@@ -74,7 +73,7 @@ export const getResponsiveMinModalHeight = (): number => {
74
73
  export const getResponsiveModalWidth = (): number => {
75
74
  try {
76
75
  const { width } = getScreenDimensions();
77
- const isTabletDevice = width >= DEVICE_BREAKPOINTS.TABLET;
76
+ const isTabletDevice = isTablet();
78
77
 
79
78
  const widthPercent = isTabletDevice
80
79
  ? MODAL_CONFIG.WIDTH_PERCENT_TABLET
@@ -92,8 +91,8 @@ export const getResponsiveModalWidth = (): number => {
92
91
 
93
92
  export const getResponsiveModalHeight = (): number => {
94
93
  try {
95
- const { width, height } = getScreenDimensions();
96
- const isTabletDevice = width >= DEVICE_BREAKPOINTS.TABLET;
94
+ const { height } = getScreenDimensions();
95
+ const isTabletDevice = isTablet();
97
96
 
98
97
  if (isTabletDevice) {
99
98
  return height * MODAL_CONFIG.HEIGHT_PERCENT_TABLET;
@@ -111,8 +110,7 @@ export const getResponsiveModalHeight = (): number => {
111
110
 
112
111
  export const getResponsiveModalBorderRadius = (): number => {
113
112
  try {
114
- const { width } = getScreenDimensions();
115
- const isTabletDevice = width >= DEVICE_BREAKPOINTS.TABLET;
113
+ const isTabletDevice = isTablet();
116
114
 
117
115
  return isTabletDevice
118
116
  ? MODAL_CONFIG.BORDER_RADIUS_TABLET
@@ -124,8 +122,7 @@ export const getResponsiveModalBorderRadius = (): number => {
124
122
 
125
123
  export const getResponsiveModalMaxWidth = (): number => {
126
124
  try {
127
- const { width } = getScreenDimensions();
128
- const isTabletDevice = width >= DEVICE_BREAKPOINTS.TABLET;
125
+ const isTabletDevice = isTablet();
129
126
 
130
127
  return isTabletDevice
131
128
  ? MODAL_CONFIG.MAX_WIDTH_TABLET
@@ -140,8 +137,7 @@ export const getResponsiveBackdropOpacity = (): number => {
140
137
  };
141
138
 
142
139
  export const getResponsiveModalLayout = (): ResponsiveModalLayout => {
143
- const { width } = getScreenDimensions();
144
- const isTabletDevice = width >= DEVICE_BREAKPOINTS.TABLET;
140
+ const isTabletDevice = isTablet();
145
141
 
146
142
  return {
147
143
  width: getResponsiveModalWidth(),
@@ -3,9 +3,8 @@
3
3
  * Responsive sizing utilities for UI components.
4
4
  */
5
5
 
6
- import { getScreenDimensions } from '../device/detection';
6
+ import { getScreenDimensions, isSmallPhone, isTablet } from '../device/detection';
7
7
  import {
8
- DEVICE_BREAKPOINTS,
9
8
  RESPONSIVE_PERCENTAGES,
10
9
  SIZE_CONSTRAINTS,
11
10
  HEIGHT_THRESHOLDS,
@@ -27,11 +26,13 @@ export const getResponsiveLogoSize = (baseSize: number = 140): number => {
27
26
  try {
28
27
  const validatedBaseSize = validateNumber(baseSize, 'baseSize', 50, 500);
29
28
  const { width } = getScreenDimensions();
29
+ const isSmallPhoneDevice = isSmallPhone();
30
+ const isTabletDevice = isTablet();
30
31
 
31
- if (width <= DEVICE_BREAKPOINTS.SMALL_PHONE) {
32
+ if (isSmallPhoneDevice) {
32
33
  const calculatedSize = safePercentage(width, RESPONSIVE_PERCENTAGES.LOGO_SMALL_PHONE_MAX);
33
34
  return clamp(calculatedSize, SIZE_CONSTRAINTS.LOGO_MIN_SMALL, SIZE_CONSTRAINTS.LOGO_MAX_SMALL);
34
- } else if (width >= DEVICE_BREAKPOINTS.TABLET) {
35
+ } else if (isTabletDevice) {
35
36
  const calculatedSize = safePercentage(width, RESPONSIVE_PERCENTAGES.LOGO_TABLET_MAX);
36
37
  return clamp(calculatedSize, SIZE_CONSTRAINTS.LOGO_MIN_TABLET, SIZE_CONSTRAINTS.LOGO_MAX_TABLET);
37
38
  }
@@ -73,11 +74,13 @@ export const getResponsiveIconContainerSize = (baseSize: number = 140): number =
73
74
  try {
74
75
  const validatedBaseSize = validateNumber(baseSize, 'baseSize', 50, 300);
75
76
  const { width } = getScreenDimensions();
77
+ const isSmallPhoneDevice = isSmallPhone();
78
+ const isTabletDevice = isTablet();
76
79
 
77
- if (width <= DEVICE_BREAKPOINTS.SMALL_PHONE) {
80
+ if (isSmallPhoneDevice) {
78
81
  const calculatedSize = safePercentage(width, RESPONSIVE_PERCENTAGES.ICON_CONTAINER_SMALL_PHONE);
79
82
  return Math.min(calculatedSize, SIZE_CONSTRAINTS.ICON_MAX_SMALL);
80
- } else if (width >= DEVICE_BREAKPOINTS.TABLET) {
83
+ } else if (isTabletDevice) {
81
84
  const calculatedSize = safePercentage(width, RESPONSIVE_PERCENTAGES.ICON_CONTAINER_TABLET);
82
85
  return Math.min(calculatedSize, SIZE_CONSTRAINTS.ICON_MAX_TABLET);
83
86
  }
@@ -96,10 +99,12 @@ export const getResponsiveMaxWidth = (baseWidth: number = 400): number => {
96
99
  try {
97
100
  const validatedBaseWidth = validateNumber(baseWidth, 'baseWidth', 100, 1000);
98
101
  const { width } = getScreenDimensions();
102
+ const isSmallPhoneDevice = isSmallPhone();
103
+ const isTabletDevice = isTablet();
99
104
 
100
- if (width <= DEVICE_BREAKPOINTS.SMALL_PHONE) {
105
+ if (isSmallPhoneDevice) {
101
106
  return safePercentage(width, RESPONSIVE_PERCENTAGES.CONTENT_SMALL_PHONE);
102
- } else if (width >= DEVICE_BREAKPOINTS.TABLET) {
107
+ } else if (isTabletDevice) {
103
108
  const calculatedWidth = safePercentage(width, RESPONSIVE_PERCENTAGES.CONTENT_TABLET);
104
109
  return Math.min(calculatedWidth, SIZE_CONSTRAINTS.CONTENT_MAX_TABLET);
105
110
  }
@@ -118,12 +123,13 @@ export const getResponsiveMaxWidth = (baseWidth: number = 400): number => {
118
123
  export const getResponsiveFontSize = (baseFontSize: number): number => {
119
124
  try {
120
125
  const validatedBaseSize = validateFontSize(baseFontSize);
121
- const { width } = getScreenDimensions();
126
+ const isSmallPhoneDevice = isSmallPhone();
127
+ const isTabletDevice = isTablet();
122
128
 
123
- if (width <= DEVICE_BREAKPOINTS.SMALL_PHONE) {
129
+ if (isSmallPhoneDevice) {
124
130
  const scaledSize = validatedBaseSize * RESPONSIVE_PERCENTAGES.FONT_SMALL_PHONE;
125
131
  return Math.max(scaledSize, SIZE_CONSTRAINTS.FONT_MIN_SIZE);
126
- } else if (width >= DEVICE_BREAKPOINTS.TABLET) {
132
+ } else if (isTabletDevice) {
127
133
  return validatedBaseSize * RESPONSIVE_PERCENTAGES.FONT_TABLET;
128
134
  }
129
135