@umituz/react-native-design-system 1.5.32 → 1.5.34

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.
Files changed (67) hide show
  1. package/package.json +4 -1
  2. package/src/presentation/atoms/AtomicDatePicker.tsx +3 -2
  3. package/src/presentation/atoms/AtomicInput.tsx +19 -12
  4. package/src/index.js +0 -100
  5. package/src/presentation/atoms/AtomicAvatar.js +0 -84
  6. package/src/presentation/atoms/AtomicAvatarGroup.js +0 -82
  7. package/src/presentation/atoms/AtomicBadge.js +0 -167
  8. package/src/presentation/atoms/AtomicButton.js +0 -171
  9. package/src/presentation/atoms/AtomicCard.js +0 -69
  10. package/src/presentation/atoms/AtomicChip.js +0 -130
  11. package/src/presentation/atoms/AtomicDatePicker.js +0 -245
  12. package/src/presentation/atoms/AtomicDivider.js +0 -57
  13. package/src/presentation/atoms/AtomicFab.js +0 -67
  14. package/src/presentation/atoms/AtomicFilter.js +0 -103
  15. package/src/presentation/atoms/AtomicFormError.js +0 -63
  16. package/src/presentation/atoms/AtomicIcon.js +0 -29
  17. package/src/presentation/atoms/AtomicImage.js +0 -91
  18. package/src/presentation/atoms/AtomicInput.js +0 -201
  19. package/src/presentation/atoms/AtomicNumberInput.js +0 -124
  20. package/src/presentation/atoms/AtomicPicker.js +0 -298
  21. package/src/presentation/atoms/AtomicProgress.js +0 -79
  22. package/src/presentation/atoms/AtomicSearchBar.js +0 -45
  23. package/src/presentation/atoms/AtomicSort.js +0 -76
  24. package/src/presentation/atoms/AtomicSwitch.js +0 -103
  25. package/src/presentation/atoms/AtomicText.js +0 -22
  26. package/src/presentation/atoms/AtomicTextArea.js +0 -195
  27. package/src/presentation/atoms/AtomicTouchable.js +0 -137
  28. package/src/presentation/atoms/fab/styles/fabStyles.js +0 -62
  29. package/src/presentation/atoms/fab/types/index.js +0 -1
  30. package/src/presentation/atoms/filter/styles/filterStyles.js +0 -28
  31. package/src/presentation/atoms/filter/types/index.js +0 -1
  32. package/src/presentation/atoms/index.js +0 -145
  33. package/src/presentation/atoms/input/hooks/useInputState.js +0 -12
  34. package/src/presentation/atoms/input/styles/inputStyles.js +0 -58
  35. package/src/presentation/atoms/input/types/index.js +0 -1
  36. package/src/presentation/atoms/picker/styles/pickerStyles.js +0 -176
  37. package/src/presentation/atoms/picker/types/index.js +0 -1
  38. package/src/presentation/atoms/touchable/styles/touchableStyles.js +0 -53
  39. package/src/presentation/atoms/touchable/types/index.js +0 -1
  40. package/src/presentation/hooks/useResponsive.js +0 -81
  41. package/src/presentation/molecules/AtomicConfirmationModal.js +0 -153
  42. package/src/presentation/molecules/EmptyState.js +0 -67
  43. package/src/presentation/molecules/FormField.js +0 -75
  44. package/src/presentation/molecules/GridContainer.js +0 -76
  45. package/src/presentation/molecules/IconContainer.js +0 -59
  46. package/src/presentation/molecules/ListItem.js +0 -23
  47. package/src/presentation/molecules/ScreenHeader.js +0 -93
  48. package/src/presentation/molecules/SearchBar.js +0 -46
  49. package/src/presentation/molecules/SectionCard.js +0 -46
  50. package/src/presentation/molecules/SectionContainer.js +0 -63
  51. package/src/presentation/molecules/SectionHeader.js +0 -72
  52. package/src/presentation/molecules/confirmation-modal/styles/confirmationModalStyles.js +0 -114
  53. package/src/presentation/molecules/confirmation-modal/types/index.js +0 -6
  54. package/src/presentation/molecules/index.js +0 -16
  55. package/src/presentation/molecules/listitem/styles/listItemStyles.js +0 -14
  56. package/src/presentation/molecules/listitem/types/index.js +0 -1
  57. package/src/presentation/organisms/AppHeader.js +0 -77
  58. package/src/presentation/organisms/FormContainer.js +0 -126
  59. package/src/presentation/organisms/ScreenLayout.js +0 -68
  60. package/src/presentation/organisms/index.js +0 -13
  61. package/src/presentation/tokens/commonStyles.js +0 -219
  62. package/src/presentation/utils/platformConstants.js +0 -113
  63. package/src/presentation/utils/responsive.js +0 -451
  64. package/src/presentation/utils/variants/compound.js +0 -15
  65. package/src/presentation/utils/variants/core.js +0 -22
  66. package/src/presentation/utils/variants/helpers.js +0 -9
  67. package/src/presentation/utils/variants.js +0 -3
@@ -1,126 +0,0 @@
1
- /**
2
- * FormContainer Component
3
- *
4
- * A reusable container for forms with proper keyboard handling and responsive layout.
5
- *
6
- * Features:
7
- * - Pure React Native implementation (no Paper dependency)
8
- * - Universal keyboard handling (no platform-specific code)
9
- * - ScrollView with automatic content padding
10
- * - Safe area insets for bottom tab navigation overlap
11
- * - Responsive max width for large screens (tablets)
12
- * - Consistent vertical spacing between form elements
13
- * - Theme-aware surface colors
14
- * - Optimized performance with memoized styles
15
- *
16
- * Usage:
17
- * ```tsx
18
- * <FormContainer>
19
- * <AtomicInput label="Name" value={name} onChangeText={setName} />
20
- * <AtomicTextArea label="Description" value={desc} onChangeText={setDesc} />
21
- * <AtomicButton variant="primary" onPress={handleSubmit}>
22
- * Submit
23
- * </AtomicButton>
24
- * </FormContainer>
25
- * ```
26
- *
27
- * Why This Component:
28
- * - Prevents keyboard from covering input fields (universal solution)
29
- * - Handles safe area (notch, bottom tabs) automatically
30
- * - Consistent form layout across all 100+ generated apps
31
- * - Responsive design for tablets (max 700px) and phones (full width)
32
- * - Automatic vertical spacing between form elements (no manual marginBottom)
33
- * - Reduces boilerplate in form screens
34
- * - Universal code - no platform checks, works on iOS, Android, Web
35
- *
36
- * Technical Details:
37
- * - Uses ScrollView with contentContainerStyle for keyboard handling
38
- * - Pure React Native View for surface (lightweight)
39
- * - Vertical spacing via Children.map() wrapping (universal compatibility)
40
- * - Safe area insets from react-native-safe-area-context
41
- * - Responsive values from useResponsive hook
42
- *
43
- * @module FormContainer
44
- */
45
- import React, { useMemo, Children } from 'react';
46
- import { ScrollView, StyleSheet, View, } from 'react-native';
47
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
48
- import { useAppDesignTokens } from '@umituz/react-native-theme';
49
- import { useResponsive } from '../hooks/useResponsive';
50
- /**
51
- * FormContainer - Universal form wrapper component
52
- *
53
- * Wraps forms with:
54
- * - Pure React Native surface
55
- * - Universal keyboard handling (no platform checks)
56
- * - ScrollView for content overflow
57
- * - Safe area insets (bottom tabs, notch)
58
- * - Responsive max width (tablets)
59
- * - Theme integration
60
- */
61
- export const FormContainer = ({ children, containerStyle, contentContainerStyle, showsVerticalScrollIndicator = false, testID, showBorder = true, }) => {
62
- const tokens = useAppDesignTokens();
63
- const insets = useSafeAreaInsets();
64
- const { formContentWidth, formBottomPadding, formElementSpacing } = useResponsive();
65
- // Memoize styles to prevent recreation on every render
66
- // Only recreate when theme colors or responsive values change
67
- const styles = useMemo(() => StyleSheet.create({
68
- container: {
69
- flex: 1,
70
- backgroundColor: tokens.colors.backgroundPrimary,
71
- },
72
- surface: {
73
- flex: 1,
74
- backgroundColor: tokens.colors.surface,
75
- borderWidth: showBorder ? 1 : 0,
76
- borderColor: tokens.colors.border,
77
- borderRadius: tokens.borders.radius.md,
78
- },
79
- scrollView: {
80
- flex: 1,
81
- },
82
- contentContainer: {
83
- flexGrow: 1,
84
- padding: tokens.spacing.lg,
85
- paddingTop: tokens.spacing.xl,
86
- // Bottom padding: base + safe area insets for tab bar
87
- paddingBottom: formBottomPadding + insets.bottom,
88
- // Responsive max width (undefined for phones, 700px for tablets)
89
- maxWidth: formContentWidth,
90
- alignSelf: 'center',
91
- width: '100%',
92
- },
93
- // Wrapper for each form element to add vertical spacing
94
- // This is the universal replacement for CSS gap property
95
- formElementWrapper: {
96
- marginBottom: formElementSpacing,
97
- },
98
- }), [
99
- tokens.colors.backgroundPrimary,
100
- tokens.colors.surface,
101
- tokens.colors.border,
102
- tokens.borders.radius.md,
103
- tokens.spacing.lg,
104
- tokens.spacing.xl,
105
- formBottomPadding,
106
- formContentWidth,
107
- formElementSpacing,
108
- insets.bottom,
109
- showBorder,
110
- ]);
111
- // Wrap each child with spacing View (universal gap replacement)
112
- // Children.map() handles arrays, fragments, single elements correctly
113
- const childrenWithSpacing = useMemo(() => {
114
- const childArray = Children.toArray(children);
115
- return childArray.map((child, index) => (<View key={index} style={index < childArray.length - 1 ? styles.formElementWrapper : undefined}>
116
- {child}
117
- </View>));
118
- }, [children, styles.formElementWrapper]);
119
- return (<View style={[styles.container, containerStyle]} testID={testID}>
120
- <View style={styles.surface}>
121
- <ScrollView style={styles.scrollView} contentContainerStyle={[styles.contentContainer, contentContainerStyle]} keyboardShouldPersistTaps="handled" keyboardDismissMode="on-drag" showsVerticalScrollIndicator={showsVerticalScrollIndicator} testID={testID ? `${testID}-scroll` : undefined}>
122
- {childrenWithSpacing}
123
- </ScrollView>
124
- </View>
125
- </View>);
126
- };
@@ -1,68 +0,0 @@
1
- /**
2
- * ScreenLayout - Universal Screen Container Component
3
- *
4
- * Provides consistent layout structure for all screens:
5
- * - SafeAreaView with configurable edges
6
- * - Optional ScrollView for content
7
- * - Theme-aware background colors
8
- * - Optional header/footer slots
9
- * - Consistent spacing and padding
10
- *
11
- * Usage:
12
- * <ScreenLayout>
13
- * <View>Your content here</View>
14
- * </ScreenLayout>
15
- *
16
- * Advanced:
17
- * <ScreenLayout
18
- * scrollable={false}
19
- * edges={['top', 'bottom']}
20
- * header={<CustomHeader />}
21
- * >
22
- * <View>Content</View>
23
- * </ScreenLayout>
24
- */
25
- import React, { useMemo } from 'react';
26
- import { View, ScrollView, StyleSheet } from 'react-native';
27
- import { SafeAreaView } from 'react-native-safe-area-context';
28
- import { useAppDesignTokens } from '@umituz/react-native-theme';
29
- export const ScreenLayout = ({ children, scrollable = true, edges = ['top'], header, footer, backgroundColor, containerStyle, contentContainerStyle, testID, hideScrollIndicator = false, keyboardAvoiding = false, }) => {
30
- // Automatically uses current theme from global store
31
- const tokens = useAppDesignTokens();
32
- const styles = useMemo(() => getStyles(tokens), [tokens]);
33
- const bgColor = backgroundColor || tokens.colors.backgroundPrimary;
34
- // Non-scrollable layout
35
- if (!scrollable) {
36
- return (<SafeAreaView style={[styles.container, { backgroundColor: bgColor }, containerStyle]} edges={edges} testID={testID}>
37
- {header}
38
- <View style={[styles.content, contentContainerStyle]}>
39
- {children}
40
- </View>
41
- {footer}
42
- </SafeAreaView>);
43
- }
44
- // Scrollable layout (default)
45
- return (<SafeAreaView style={[styles.container, { backgroundColor: bgColor }, containerStyle]} edges={edges} testID={testID}>
46
- {header}
47
- <ScrollView style={styles.scrollView} contentContainerStyle={[styles.scrollContent, contentContainerStyle]} showsVerticalScrollIndicator={!hideScrollIndicator} keyboardShouldPersistTaps={keyboardAvoiding ? 'handled' : 'never'}>
48
- {children}
49
- </ScrollView>
50
- {footer}
51
- </SafeAreaView>);
52
- };
53
- const getStyles = (tokens) => StyleSheet.create({
54
- container: {
55
- flex: 1,
56
- },
57
- content: {
58
- flex: 1,
59
- },
60
- scrollView: {
61
- flex: 1,
62
- },
63
- scrollContent: {
64
- flexGrow: 1,
65
- paddingHorizontal: tokens.spacing.md,
66
- paddingBottom: tokens.spacing.lg,
67
- },
68
- });
@@ -1,13 +0,0 @@
1
- /**
2
- * Organism Components Export Index
3
- *
4
- * Organisms are complex components composed of molecules and atoms
5
- * Theme: {{THEME_NAME}} ({{CATEGORY}} category)
6
- *
7
- * Atomic Design Level: ORGANISMS
8
- */
9
- // Component exports
10
- // AppHeader - Main application header with navigation
11
- export { AppHeader } from './AppHeader';
12
- // ScreenLayout - Universal screen container with consistent layout
13
- export { ScreenLayout } from './ScreenLayout';
@@ -1,219 +0,0 @@
1
- /**
2
- * Common Styles - Reusable Style Patterns
3
- *
4
- * Centralized style utilities to reduce duplication across screens.
5
- * These styles are composable and follow DRY principles.
6
- *
7
- * Usage:
8
- * ```typescript
9
- * import { useCommonStyles } from '@domains/design-system/commonStyles';
10
- *
11
- * const MyComponent = () => {
12
- * const commonStyles = useCommonStyles();
13
- * return <View style={commonStyles.screenContainer}>...</View>;
14
- * };
15
- * ```
16
- */
17
- import { useAppDesignTokens } from '@umituz/react-native-theme';
18
- /**
19
- * Hook to get common styles with dynamic theme support
20
- */
21
- export const useCommonStyles = () => {
22
- const tokens = useAppDesignTokens();
23
- return {
24
- // ========================================================================
25
- // SCREEN CONTAINERS
26
- // ========================================================================
27
- /**
28
- * Standard full-screen container
29
- * Most common pattern: flex: 1 with background color
30
- */
31
- screenContainer: {
32
- flex: 1,
33
- backgroundColor: tokens.colors.backgroundPrimary,
34
- },
35
- /**
36
- * Basic flex container without background
37
- * Use when background is set elsewhere or not needed
38
- */
39
- flexContainer: {
40
- flex: 1,
41
- },
42
- /**
43
- * Screen container with secondary background
44
- */
45
- screenContainerSecondary: {
46
- flex: 1,
47
- backgroundColor: tokens.colors.backgroundSecondary,
48
- },
49
- // ========================================================================
50
- // SCROLL CONTAINERS
51
- // ========================================================================
52
- /**
53
- * Standard ScrollView wrapper
54
- */
55
- scrollView: {
56
- flex: 1,
57
- },
58
- /**
59
- * ScrollView content container with standard padding
60
- */
61
- scrollContent: {
62
- paddingHorizontal: tokens.spacing.lg,
63
- paddingBottom: tokens.spacing.xl,
64
- },
65
- /**
66
- * ScrollView content that grows to fill available space
67
- */
68
- scrollContentGrow: {
69
- flexGrow: 1,
70
- padding: tokens.spacing.lg,
71
- },
72
- /**
73
- * Centered scroll content (for forms, onboarding screens)
74
- */
75
- scrollContentCentered: {
76
- flexGrow: 1,
77
- padding: tokens.spacing.lg,
78
- justifyContent: 'center',
79
- },
80
- // ========================================================================
81
- // LAYOUT UTILITIES
82
- // ========================================================================
83
- /**
84
- * Centered container - both horizontal and vertical
85
- * Perfect for empty states, splash screens
86
- */
87
- centerContainer: {
88
- flex: 1,
89
- justifyContent: 'center',
90
- alignItems: 'center',
91
- },
92
- /**
93
- * Centered container with padding
94
- */
95
- centerContainerPadded: {
96
- flex: 1,
97
- justifyContent: 'center',
98
- alignItems: 'center',
99
- paddingHorizontal: tokens.spacing.xl,
100
- },
101
- /**
102
- * Horizontal row layout
103
- */
104
- row: {
105
- flexDirection: 'row',
106
- alignItems: 'center',
107
- },
108
- /**
109
- * Horizontal row with space between
110
- */
111
- rowBetween: {
112
- flexDirection: 'row',
113
- alignItems: 'center',
114
- justifyContent: 'space-between',
115
- },
116
- /**
117
- * Horizontal row centered
118
- */
119
- rowCenter: {
120
- flexDirection: 'row',
121
- alignItems: 'center',
122
- justifyContent: 'center',
123
- },
124
- // ========================================================================
125
- // PADDING UTILITIES
126
- // ========================================================================
127
- /**
128
- * Standard horizontal padding
129
- */
130
- paddedHorizontal: {
131
- paddingHorizontal: tokens.spacing.lg,
132
- },
133
- /**
134
- * Standard vertical padding
135
- */
136
- paddedVertical: {
137
- paddingVertical: tokens.spacing.lg,
138
- },
139
- /**
140
- * Standard padding all sides
141
- */
142
- padded: {
143
- padding: tokens.spacing.lg,
144
- },
145
- // ========================================================================
146
- // SECTION STYLES
147
- // ========================================================================
148
- /**
149
- * Standard section container
150
- */
151
- section: {
152
- marginBottom: tokens.spacing.xl,
153
- },
154
- /**
155
- * Section with padding
156
- */
157
- sectionPadded: {
158
- marginBottom: tokens.spacing.xl,
159
- paddingHorizontal: tokens.spacing.lg,
160
- },
161
- // ========================================================================
162
- // TEXT STYLES
163
- // ========================================================================
164
- /**
165
- * Screen title - primary heading
166
- */
167
- screenTitle: {
168
- ...tokens.typography.headingLarge,
169
- color: tokens.colors.textPrimary,
170
- marginBottom: tokens.spacing.sm,
171
- },
172
- /**
173
- * Section title
174
- */
175
- sectionTitle: {
176
- ...tokens.typography.headingMedium,
177
- color: tokens.colors.textPrimary,
178
- marginBottom: tokens.spacing.md,
179
- },
180
- /**
181
- * Subtitle/description text
182
- */
183
- subtitle: {
184
- ...tokens.typography.bodyMedium,
185
- color: tokens.colors.textSecondary,
186
- textAlign: 'center',
187
- },
188
- /**
189
- * Body text
190
- */
191
- bodyText: {
192
- ...tokens.typography.bodyMedium,
193
- color: tokens.colors.textPrimary,
194
- },
195
- /**
196
- * Secondary text (muted)
197
- */
198
- secondaryText: {
199
- ...tokens.typography.bodySmall,
200
- color: tokens.colors.textSecondary,
201
- },
202
- // ========================================================================
203
- // FORM STYLES
204
- // ========================================================================
205
- /**
206
- * Form container
207
- */
208
- form: {
209
- width: '100%',
210
- },
211
- /**
212
- * Form header section
213
- */
214
- formHeader: {
215
- alignItems: 'center',
216
- marginBottom: tokens.spacing.xl,
217
- },
218
- };
219
- };
@@ -1,113 +0,0 @@
1
- /**
2
- * Platform-Specific Constants
3
- *
4
- * Design system constants that ensure compliance with platform guidelines.
5
- * These values are based on official Human Interface Guidelines (HIG) from Apple and Material Design from Google.
6
- */
7
- /**
8
- * iOS Human Interface Guidelines (HIG) Constants
9
- *
10
- * @see https://developer.apple.com/design/human-interface-guidelines/layout
11
- */
12
- export const IOS_HIG = {
13
- /**
14
- * Minimum Touch Target Size
15
- *
16
- * Apple requires a minimum tappable area of 44pt x 44pt for ALL interactive controls.
17
- * This is enforced during App Store review.
18
- *
19
- * @critical Violating this can result in App Store rejection
20
- */
21
- MIN_TOUCH_TARGET: 44,
22
- /**
23
- * Recommended Minimum Touch Target Size
24
- *
25
- * For better accessibility and usability, Apple recommends 48pt x 48pt.
26
- */
27
- RECOMMENDED_TOUCH_TARGET: 48,
28
- /**
29
- * Minimum Text Size
30
- *
31
- * Minimum font size for body text to ensure readability.
32
- */
33
- MIN_TEXT_SIZE: 17,
34
- /**
35
- * Minimum Contrast Ratio
36
- *
37
- * WCAG AA compliance requires 4.5:1 for normal text.
38
- */
39
- MIN_CONTRAST_RATIO: 4.5,
40
- };
41
- /**
42
- * Android Material Design Guidelines Constants
43
- *
44
- * @see https://m3.material.io/foundations/layout/applying-layout/window-size-classes
45
- */
46
- export const ANDROID_MATERIAL = {
47
- /**
48
- * Minimum Touch Target Size
49
- *
50
- * Material Design 3 recommends a minimum of 48dp x 48dp.
51
- */
52
- MIN_TOUCH_TARGET: 48,
53
- /**
54
- * Minimum Text Size
55
- *
56
- * Minimum font size for body text.
57
- */
58
- MIN_TEXT_SIZE: 14,
59
- };
60
- /**
61
- * Universal Platform Constants
62
- *
63
- * These values work across both iOS and Android, taking the more restrictive requirement.
64
- */
65
- export const PLATFORM_CONSTANTS = {
66
- /**
67
- * Minimum Touch Target Size
68
- *
69
- * Uses iOS requirement (44pt) as it's more restrictive than Android (48dp).
70
- * This ensures compliance on both platforms.
71
- */
72
- MIN_TOUCH_TARGET: Math.max(IOS_HIG.MIN_TOUCH_TARGET, ANDROID_MATERIAL.MIN_TOUCH_TARGET),
73
- /**
74
- * Recommended Touch Target Size
75
- *
76
- * Uses the higher value between iOS and Android recommendations.
77
- */
78
- RECOMMENDED_TOUCH_TARGET: 48,
79
- /**
80
- * Minimum Text Size
81
- *
82
- * Uses iOS requirement as it's larger.
83
- */
84
- MIN_TEXT_SIZE: Math.max(IOS_HIG.MIN_TEXT_SIZE, ANDROID_MATERIAL.MIN_TEXT_SIZE),
85
- };
86
- /**
87
- * Helper function to validate touch target size
88
- *
89
- * @param size - The size to validate (in pt/dp)
90
- * @returns true if size meets platform requirements
91
- */
92
- export const isValidTouchTarget = (size) => {
93
- return size >= IOS_HIG.MIN_TOUCH_TARGET;
94
- };
95
- /**
96
- * Helper function to get minimum touch target for component
97
- *
98
- * @param componentType - The type of component ('button' | 'input' | 'icon' | 'generic')
99
- * @returns The minimum touch target size for that component type
100
- */
101
- export const getMinTouchTarget = (componentType = 'generic') => {
102
- switch (componentType) {
103
- case 'button':
104
- return PLATFORM_CONSTANTS.RECOMMENDED_TOUCH_TARGET; // 48pt recommended for buttons
105
- case 'input':
106
- return PLATFORM_CONSTANTS.RECOMMENDED_TOUCH_TARGET; // 48pt recommended for inputs
107
- case 'icon':
108
- return IOS_HIG.MIN_TOUCH_TARGET; // 44pt minimum for icon buttons
109
- case 'generic':
110
- default:
111
- return IOS_HIG.MIN_TOUCH_TARGET; // 44pt minimum for all other interactive elements
112
- }
113
- };