@umituz/react-native-design-system 4.25.6 → 4.25.8

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": "4.25.6",
3
+ "version": "4.25.8",
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",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -40,7 +40,6 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@react-native-async-storage/async-storage": "^2.2.0",
43
- "@react-native-community/datetimepicker": "^8.6.0",
44
43
  "react-native-svg": "^15.12.1",
45
44
  "rn-emoji-keyboard": "^1.7.0"
46
45
  },
@@ -93,7 +92,8 @@
93
92
  "react-native": "*",
94
93
  "react-native-gesture-handler": ">=2.20.0",
95
94
  "react-native-safe-area-context": ">=5.6.2",
96
- "zustand": ">=5.0.0"
95
+ "zustand": ">=5.0.0",
96
+ "@react-native-community/datetimepicker": ">=8.0.0"
97
97
  },
98
98
  "peerDependenciesMeta": {
99
99
  "@react-navigation/native": {
@@ -101,6 +101,9 @@
101
101
  },
102
102
  "expo-application": {
103
103
  "optional": true
104
+ },
105
+ "@react-native-community/datetimepicker": {
106
+ "optional": true
104
107
  }
105
108
  },
106
109
  "devDependencies": {
@@ -4,35 +4,9 @@
4
4
  * A reusable date picker component that wraps the native date picker
5
5
  * with consistent styling and behavior across platforms.
6
6
  *
7
- * Features:
8
- * - Platform-specific native pickers (iOS wheel, Android dialog)
9
- * - Consistent styling with design tokens
10
- * - Locale-aware date/time formatting (native Date methods)
11
- * - Timezone-aware (respects device timezone)
12
- * - Automatic language integration (native locale support)
13
- * - Optional label and error states
14
- * - Minimum and maximum date constraints
15
- * - Disabled state support
16
- * - Theme-aware styling
17
- * - Proper keyboard avoidance on iOS
18
- *
19
- * Usage:
20
- * ```tsx
21
- * const [selectedDate, setSelectedDate] = useState(new Date());
22
- *
23
- * <AtomicDatePicker
24
- * value={selectedDate}
25
- * onChange={setSelectedDate}
26
- * label="Birth Date"
27
- * minimumDate={new Date(1900, 0, 1)}
28
- * maximumDate={new Date()}
29
- * />
30
- * ```
31
- *
32
- * Platform Behavior:
33
- * - Opens bottom sheet from bottom with spinner wheel
34
- * - Requires "Done" button to confirm selection
35
- * - Can be dismissed by swiping down or tapping backdrop
7
+ * Requires @react-native-community/datetimepicker as a peer dependency.
8
+ * If not installed, the component will render only the button with a
9
+ * console warning when pressed.
36
10
  *
37
11
  * @module AtomicDatePicker
38
12
  */
@@ -44,7 +18,6 @@ import {
44
18
  type StyleProp,
45
19
  type ViewStyle,
46
20
  } from 'react-native';
47
- import DateTimePicker, { DateTimePickerEvent } from '@react-native-community/datetimepicker';
48
21
  import { useAppDesignTokens } from '../theme';
49
22
  import { AtomicText } from './AtomicText';
50
23
  import { DatePickerModal } from './datepicker/components/DatePickerModal';
@@ -52,6 +25,18 @@ import { DatePickerButton } from './datepicker/components/DatePickerButton';
52
25
  import { useDatePickerText } from './datepicker/hooks/useDatePickerText';
53
26
  import { getDatePickerStyles } from './datepicker/styles/datePickerStyles';
54
27
 
28
+ let DateTimePicker: any = null;
29
+ try {
30
+ DateTimePicker = require('@react-native-community/datetimepicker').default;
31
+ } catch {
32
+ // Optional peer dependency not installed
33
+ }
34
+
35
+ type DateTimePickerEvent = {
36
+ type: 'set' | 'dismissed' | 'neutralButtonPressed';
37
+ nativeEvent: { timestamp: number; utcOffset: number };
38
+ };
39
+
55
40
  /**
56
41
  * Props for AtomicDatePicker component
57
42
  */
@@ -80,16 +65,6 @@ export interface AtomicDatePickerProps {
80
65
  style?: StyleProp<ViewStyle>;
81
66
  }
82
67
 
83
- /**
84
- * AtomicDatePicker - Universal date/time picker component
85
- *
86
- * Wraps @react-native-community/datetimepicker with:
87
- * - Theme integration
88
- * - Platform-specific modal handling
89
- * - Error states
90
- * - Disabled states
91
- * - Responsive sizing
92
- */
93
68
  export const AtomicDatePicker: React.FC<AtomicDatePickerProps> = ({
94
69
  value,
95
70
  onChange,
@@ -106,10 +81,6 @@ export const AtomicDatePicker: React.FC<AtomicDatePickerProps> = ({
106
81
  const tokens = useAppDesignTokens();
107
82
  const [showPicker, setShowPicker] = useState(false);
108
83
 
109
- /**
110
- * Handle date/time change in picker
111
- * On Android, directly apply the change. On iOS, show picker in modal and apply on confirm.
112
- */
113
84
  const handleChange = (event: DateTimePickerEvent, selectedDate?: Date) => {
114
85
  if (Platform.OS === 'android') {
115
86
  setShowPicker(false);
@@ -117,27 +88,24 @@ export const AtomicDatePicker: React.FC<AtomicDatePickerProps> = ({
117
88
  onChange(selectedDate);
118
89
  }
119
90
  } else {
120
- // iOS: Update value while picker is open
121
91
  if (event.type === 'set' && selectedDate) {
122
92
  onChange(selectedDate);
123
93
  }
124
- // iOS: Close on dismiss (swipe down)
125
94
  if (event.type === 'dismissed') {
126
95
  setShowPicker(false);
127
96
  }
128
97
  }
129
98
  };
130
99
 
131
- /**
132
- * Handle open - show native picker
133
- */
134
100
  const handleOpen = () => {
135
- if (Platform.OS === 'android') {
136
- setShowPicker(true);
137
- } else {
138
- // iOS: Show picker inline
139
- setShowPicker(true);
101
+ if (!DateTimePicker) {
102
+ console.warn(
103
+ '[AtomicDatePicker] @react-native-community/datetimepicker is not installed. ' +
104
+ 'Install it to use the date picker: npx expo install @react-native-community/datetimepicker'
105
+ );
106
+ return;
140
107
  }
108
+ setShowPicker(true);
141
109
  };
142
110
 
143
111
  const { displayText } = useDatePickerText({ value, placeholder, mode });
@@ -167,19 +135,21 @@ export const AtomicDatePicker: React.FC<AtomicDatePickerProps> = ({
167
135
  )}
168
136
 
169
137
  {/* iOS Modal */}
170
- <DatePickerModal
171
- visible={Platform.OS === 'ios' && showPicker}
172
- onClose={() => setShowPicker(false)}
173
- onDateChange={handleChange}
174
- currentDate={value ?? new Date()}
175
- mode={mode}
176
- minimumDate={minimumDate}
177
- maximumDate={maximumDate}
178
- testID={testID}
179
- />
138
+ {DateTimePicker && (
139
+ <DatePickerModal
140
+ visible={Platform.OS === 'ios' && showPicker}
141
+ onClose={() => setShowPicker(false)}
142
+ onDateChange={handleChange}
143
+ currentDate={value ?? new Date()}
144
+ mode={mode}
145
+ minimumDate={minimumDate}
146
+ maximumDate={maximumDate}
147
+ testID={testID}
148
+ />
149
+ )}
180
150
 
181
151
  {/* Android Picker */}
182
- {Platform.OS === 'android' && showPicker && (
152
+ {DateTimePicker && Platform.OS === 'android' && showPicker && (
183
153
  <DateTimePicker
184
154
  value={value ?? new Date()}
185
155
  mode={mode}
@@ -2,7 +2,7 @@
2
2
  * DatePickerModal Component
3
3
  *
4
4
  * Modal component for iOS date picker with proper styling and behavior.
5
- * Extracted from AtomicDatePicker for better separation of concerns.
5
+ * Uses lazy-loaded @react-native-community/datetimepicker (optional peer dependency).
6
6
  */
7
7
 
8
8
  import React, { useMemo } from 'react';
@@ -14,10 +14,21 @@ import {
14
14
  Platform,
15
15
  } from 'react-native';
16
16
  import { useSafeAreaInsets } from '../../../safe-area';
17
- import DateTimePicker, { DateTimePickerEvent } from '@react-native-community/datetimepicker';
18
17
  import { useAppDesignTokens } from '../../../theme';
19
18
  import { AtomicText } from '../../AtomicText';
20
19
 
20
+ let DateTimePicker: any = null;
21
+ try {
22
+ DateTimePicker = require('@react-native-community/datetimepicker').default;
23
+ } catch {
24
+ // Optional peer dependency not installed
25
+ }
26
+
27
+ type DateTimePickerEvent = {
28
+ type: 'set' | 'dismissed' | 'neutralButtonPressed';
29
+ nativeEvent: { timestamp: number; utcOffset: number };
30
+ };
31
+
21
32
  interface DatePickerModalProps {
22
33
  visible: boolean;
23
34
  onClose: () => void;
@@ -91,7 +102,7 @@ export const DatePickerModal: React.FC<DatePickerModalProps> = ({
91
102
  },
92
103
  }), [overlayOpacity, tokens, insets.bottom]);
93
104
 
94
- if (Platform.OS !== 'ios') {
105
+ if (Platform.OS !== 'ios' || !DateTimePicker) {
95
106
  return null;
96
107
  }
97
108
 
@@ -140,4 +151,4 @@ export const DatePickerModal: React.FC<DatePickerModalProps> = ({
140
151
  </View>
141
152
  </Modal>
142
153
  );
143
- };
154
+ };
package/src/index.ts CHANGED
@@ -2,14 +2,16 @@
2
2
  * @umituz/react-native-design-system
3
3
  * Universal design system for React Native apps
4
4
  *
5
- * Consolidated package including:
6
- * - Atoms (primitive UI components)
7
- * - Molecules (composite components)
8
- * - Organisms (complex UI patterns)
9
- * - Theme (design tokens, colors)
10
- * - Typography (text styles)
11
- * - Responsive (screen utilities)
12
- * - Safe Area (safe area utilities and hooks)
5
+ * This main entry point exports only modules with NO optional native dependencies.
6
+ * Modules with native dependencies are available via sub-path imports:
7
+ * - @umituz/react-native-design-system/gallery (expo-media-library)
8
+ * - @umituz/react-native-design-system/media (expo-file-system, expo-image-picker, expo-media-library)
9
+ * - @umituz/react-native-design-system/filesystem (expo-file-system)
10
+ * - @umituz/react-native-design-system/image (expo-file-system, expo-image-manipulator)
11
+ * - @umituz/react-native-design-system/device (expo-device, expo-secure-store)
12
+ * - @umituz/react-native-design-system/offline (expo-network)
13
+ * - @umituz/react-native-design-system/onboarding (expo-video)
14
+ * - @umituz/react-native-design-system/storage (expo-secure-store)
13
15
  */
14
16
 
15
17
  // =============================================================================
@@ -27,11 +29,6 @@ export * from "./typography";
27
29
  // =============================================================================
28
30
  export * from "./responsive";
29
31
 
30
- // =============================================================================
31
- // DEVICE EXPORTS
32
- // =============================================================================
33
- export * from "./device";
34
-
35
32
  // =============================================================================
36
33
  // ATOMS EXPORTS
37
34
  // =============================================================================
@@ -67,67 +64,27 @@ export * from "./exception";
67
64
  // =============================================================================
68
65
  export * from "./infinite-scroll";
69
66
 
70
- // =============================================================================
71
- // UUID EXPORTS
72
- // =============================================================================
73
- export * from "./uuid";
74
-
75
67
  // =============================================================================
76
68
  // TIMEZONE EXPORTS
77
69
  // =============================================================================
78
70
  export * from "./timezone";
79
71
 
80
- // =============================================================================
81
- // OFFLINE EXPORTS
82
- // =============================================================================
83
- export * from "./offline";
84
-
85
- // =============================================================================
86
- // IMAGE EXPORTS
87
- // =============================================================================
88
- export * from "./image";
89
-
90
72
  // =============================================================================
91
73
  // HAPTICS EXPORTS
92
74
  // =============================================================================
93
75
  export * from "./haptics";
94
76
 
95
- // =============================================================================
96
- // MEDIA EXPORTS
97
- // =============================================================================
98
- export * from "./media";
99
-
100
77
  // =============================================================================
101
78
  // VARIANT UTILITIES
102
79
  // =============================================================================
103
80
  export * from "./presentation/utils/variants";
104
81
 
105
- // =============================================================================
106
- // UTILITIES
107
- // =============================================================================
108
- export * from "./utilities";
109
-
110
82
  // =============================================================================
111
83
  // UTILS EXPORTS (Logger, formatters, validators)
112
84
  // =============================================================================
113
85
  export { logger, Logger } from "./utils/logger";
114
86
  export type { LoggerConfig } from "./utils/logger";
115
87
 
116
- // =============================================================================
117
- // STORAGE EXPORTS
118
- // =============================================================================
119
- export * from "./storage";
120
-
121
-
122
- // =============================================================================
123
- // ONBOARDING EXPORTS
124
- // =============================================================================
125
- export * from "./onboarding";
126
- // =============================================================================
127
- // FILESYSTEM EXPORTS
128
- // =============================================================================
129
- export * from "./filesystem";
130
-
131
88
  // =============================================================================
132
89
  // TANSTACK EXPORTS
133
90
  // =============================================================================
@@ -144,9 +101,9 @@ export * from "./loading";
144
101
  export * from "./init";
145
102
 
146
103
  // =============================================================================
147
- // GALLERY EXPORTS
104
+ // STORAGE EXPORTS
148
105
  // =============================================================================
149
- export * from "./gallery";
106
+ export * from "./storage";
150
107
 
151
108
  // =============================================================================
152
109
  // CAROUSEL EXPORTS