@umituz/react-native-design-system 1.5.36 → 1.5.38

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 (62) hide show
  1. package/README.md +2 -2
  2. package/package.json +7 -5
  3. package/src/index.ts +29 -221
  4. package/src/presentation/organisms/AppHeader.tsx +3 -5
  5. package/src/presentation/tokens/commonStyles.ts +1 -1
  6. package/src/presentation/atoms/AtomicAvatar.tsx +0 -157
  7. package/src/presentation/atoms/AtomicAvatarGroup.tsx +0 -169
  8. package/src/presentation/atoms/AtomicBadge.tsx +0 -232
  9. package/src/presentation/atoms/AtomicButton.tsx +0 -236
  10. package/src/presentation/atoms/AtomicCard.tsx +0 -107
  11. package/src/presentation/atoms/AtomicChip.tsx +0 -223
  12. package/src/presentation/atoms/AtomicDatePicker.tsx +0 -347
  13. package/src/presentation/atoms/AtomicDivider.tsx +0 -114
  14. package/src/presentation/atoms/AtomicFab.tsx +0 -98
  15. package/src/presentation/atoms/AtomicFilter.tsx +0 -154
  16. package/src/presentation/atoms/AtomicFormError.tsx +0 -105
  17. package/src/presentation/atoms/AtomicIcon.tsx +0 -40
  18. package/src/presentation/atoms/AtomicImage.tsx +0 -149
  19. package/src/presentation/atoms/AtomicInput.tsx +0 -363
  20. package/src/presentation/atoms/AtomicNumberInput.tsx +0 -182
  21. package/src/presentation/atoms/AtomicPicker.tsx +0 -458
  22. package/src/presentation/atoms/AtomicProgress.tsx +0 -139
  23. package/src/presentation/atoms/AtomicSearchBar.tsx +0 -114
  24. package/src/presentation/atoms/AtomicSort.tsx +0 -145
  25. package/src/presentation/atoms/AtomicSwitch.tsx +0 -166
  26. package/src/presentation/atoms/AtomicText.tsx +0 -55
  27. package/src/presentation/atoms/AtomicTextArea.tsx +0 -313
  28. package/src/presentation/atoms/AtomicTouchable.tsx +0 -209
  29. package/src/presentation/atoms/fab/styles/fabStyles.ts +0 -69
  30. package/src/presentation/atoms/fab/types/index.ts +0 -82
  31. package/src/presentation/atoms/filter/styles/filterStyles.ts +0 -32
  32. package/src/presentation/atoms/filter/types/index.ts +0 -89
  33. package/src/presentation/atoms/index.ts +0 -366
  34. package/src/presentation/atoms/input/hooks/useInputState.ts +0 -15
  35. package/src/presentation/atoms/input/styles/inputStyles.ts +0 -66
  36. package/src/presentation/atoms/input/types/index.ts +0 -25
  37. package/src/presentation/atoms/picker/styles/pickerStyles.ts +0 -207
  38. package/src/presentation/atoms/picker/types/index.ts +0 -40
  39. package/src/presentation/atoms/touchable/styles/touchableStyles.ts +0 -62
  40. package/src/presentation/atoms/touchable/types/index.ts +0 -155
  41. package/src/presentation/hooks/useResponsive.ts +0 -180
  42. package/src/presentation/molecules/AtomicConfirmationModal.tsx +0 -243
  43. package/src/presentation/molecules/EmptyState.tsx +0 -130
  44. package/src/presentation/molecules/FormField.tsx +0 -128
  45. package/src/presentation/molecules/GridContainer.tsx +0 -124
  46. package/src/presentation/molecules/IconContainer.tsx +0 -94
  47. package/src/presentation/molecules/ListItem.tsx +0 -36
  48. package/src/presentation/molecules/ScreenHeader.tsx +0 -140
  49. package/src/presentation/molecules/SearchBar.tsx +0 -85
  50. package/src/presentation/molecules/SectionCard.tsx +0 -74
  51. package/src/presentation/molecules/SectionContainer.tsx +0 -106
  52. package/src/presentation/molecules/SectionHeader.tsx +0 -125
  53. package/src/presentation/molecules/confirmation-modal/styles/confirmationModalStyles.ts +0 -133
  54. package/src/presentation/molecules/confirmation-modal/types/index.ts +0 -105
  55. package/src/presentation/molecules/index.ts +0 -41
  56. package/src/presentation/molecules/listitem/styles/listItemStyles.ts +0 -19
  57. package/src/presentation/molecules/listitem/types/index.ts +0 -17
  58. package/src/presentation/organisms/FormContainer.tsx +0 -180
  59. package/src/presentation/organisms/ScreenLayout.tsx +0 -171
  60. package/src/presentation/organisms/index.ts +0 -25
  61. package/src/presentation/utils/platformConstants.ts +0 -124
  62. package/src/presentation/utils/responsive.ts +0 -516
@@ -1,17 +0,0 @@
1
- import { ViewStyle } from 'react-native';
2
-
3
- /**
4
- * ListItem component props
5
- *
6
- * leftIcon/rightIcon: Any MaterialIcons name
7
- * @see https://fonts.google.com/icons
8
- */
9
- export interface ListItemProps {
10
- title: string;
11
- subtitle?: string;
12
- leftIcon?: string; // MaterialIcons name
13
- rightIcon?: string; // MaterialIcons name
14
- onPress?: () => void;
15
- disabled?: boolean;
16
- style?: ViewStyle;
17
- }
@@ -1,180 +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
-
46
- import React, { useMemo, Children } from 'react';
47
- import {
48
- ScrollView,
49
- StyleSheet,
50
- View,
51
- StyleProp,
52
- ViewStyle,
53
- } from 'react-native';
54
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
55
- import { useAppDesignTokens } from '@umituz/react-native-theme';
56
- import { useResponsive } from '../hooks/useResponsive';
57
-
58
- /**
59
- * Props for FormContainer component
60
- */
61
- export interface FormContainerProps {
62
- /** Form content (inputs, buttons, etc.) */
63
- children: React.ReactNode;
64
- /** Container style override (for outer View) */
65
- containerStyle?: StyleProp<ViewStyle>;
66
- /** Content container style override (for ScrollView content) */
67
- contentContainerStyle?: StyleProp<ViewStyle>;
68
- /** Show vertical scroll indicator */
69
- showsVerticalScrollIndicator?: boolean;
70
- /** Optional test ID for E2E testing */
71
- testID?: string;
72
- /** Show surface border (default: true) */
73
- showBorder?: boolean;
74
- }
75
-
76
- /**
77
- * FormContainer - Universal form wrapper component
78
- *
79
- * Wraps forms with:
80
- * - Pure React Native surface
81
- * - Universal keyboard handling (no platform checks)
82
- * - ScrollView for content overflow
83
- * - Safe area insets (bottom tabs, notch)
84
- * - Responsive max width (tablets)
85
- * - Theme integration
86
- */
87
- export const FormContainer: React.FC<FormContainerProps> = ({
88
- children,
89
- containerStyle,
90
- contentContainerStyle,
91
- showsVerticalScrollIndicator = false,
92
- testID,
93
- showBorder = true,
94
- }) => {
95
- const tokens = useAppDesignTokens();
96
- const insets = useSafeAreaInsets();
97
- const { formContentWidth, formBottomPadding, formElementSpacing } = useResponsive();
98
-
99
- // Memoize styles to prevent recreation on every render
100
- // Only recreate when theme colors or responsive values change
101
- const styles = useMemo(
102
- () =>
103
- StyleSheet.create({
104
- container: {
105
- flex: 1,
106
- backgroundColor: tokens.colors.backgroundPrimary,
107
- },
108
- surface: {
109
- flex: 1,
110
- backgroundColor: tokens.colors.surface,
111
- borderWidth: showBorder ? 1 : 0,
112
- borderColor: tokens.colors.border,
113
- borderRadius: tokens.borders.radius.md,
114
- },
115
- scrollView: {
116
- flex: 1,
117
- },
118
- contentContainer: {
119
- flexGrow: 1,
120
- padding: tokens.spacing.lg,
121
- paddingTop: tokens.spacing.xl,
122
- // Bottom padding: base + safe area insets for tab bar
123
- paddingBottom: formBottomPadding + insets.bottom,
124
- // Responsive max width (undefined for phones, 700px for tablets)
125
- maxWidth: formContentWidth,
126
- alignSelf: 'center',
127
- width: '100%',
128
- },
129
- // Wrapper for each form element to add vertical spacing
130
- // This is the universal replacement for CSS gap property
131
- formElementWrapper: {
132
- marginBottom: formElementSpacing,
133
- },
134
- }),
135
- [
136
- tokens.colors.backgroundPrimary,
137
- tokens.colors.surface,
138
- tokens.colors.border,
139
- tokens.borders.radius.md,
140
- tokens.spacing.lg,
141
- tokens.spacing.xl,
142
- formBottomPadding,
143
- formContentWidth,
144
- formElementSpacing,
145
- insets.bottom,
146
- showBorder,
147
- ]
148
- );
149
-
150
- // Wrap each child with spacing View (universal gap replacement)
151
- // Children.map() handles arrays, fragments, single elements correctly
152
- const childrenWithSpacing = useMemo(() => {
153
- const childArray = Children.toArray(children);
154
- return childArray.map((child, index) => (
155
- <View
156
- key={index}
157
- style={index < childArray.length - 1 ? styles.formElementWrapper : undefined}
158
- >
159
- {child}
160
- </View>
161
- ));
162
- }, [children, styles.formElementWrapper]);
163
-
164
- return (
165
- <View style={[styles.container, containerStyle]} testID={testID}>
166
- <View style={styles.surface}>
167
- <ScrollView
168
- style={styles.scrollView}
169
- contentContainerStyle={[styles.contentContainer, contentContainerStyle]}
170
- keyboardShouldPersistTaps="handled"
171
- keyboardDismissMode="on-drag"
172
- showsVerticalScrollIndicator={showsVerticalScrollIndicator}
173
- testID={testID ? `${testID}-scroll` : undefined}
174
- >
175
- {childrenWithSpacing}
176
- </ScrollView>
177
- </View>
178
- </View>
179
- );
180
- };
@@ -1,171 +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
-
26
- import React, { useMemo } from 'react';
27
- import { View, ScrollView, StyleSheet, ViewStyle } from 'react-native';
28
- import { SafeAreaView, Edge } from 'react-native-safe-area-context';
29
- import { useAppDesignTokens } from '@umituz/react-native-theme';
30
-
31
- export interface ScreenLayoutProps {
32
- /**
33
- * Content to render inside the layout
34
- */
35
- children: React.ReactNode;
36
-
37
- /**
38
- * Enable scrolling (default: true)
39
- * Set to false for screens with custom scroll logic
40
- */
41
- scrollable?: boolean;
42
-
43
- /**
44
- * Safe area edges to apply (default: ['top'])
45
- * Common values:
46
- * - ['top'] - For screens with bottom tabs
47
- * - ['top', 'bottom'] - For modal screens
48
- * - [] - No safe area (use cautiously)
49
- */
50
- edges?: Edge[];
51
-
52
- /**
53
- * Optional header component
54
- * Rendered above scrollable content
55
- */
56
- header?: React.ReactNode;
57
-
58
- /**
59
- * Optional footer component
60
- * Rendered below scrollable content
61
- */
62
- footer?: React.ReactNode;
63
-
64
- /**
65
- * Override background color
66
- * If not provided, uses theme's backgroundPrimary
67
- */
68
- backgroundColor?: string;
69
-
70
- /**
71
- * Custom container style
72
- */
73
- containerStyle?: ViewStyle;
74
-
75
- /**
76
- * Custom content container style (for ScrollView)
77
- */
78
- contentContainerStyle?: ViewStyle;
79
-
80
- /**
81
- * Test ID for automation
82
- */
83
- testID?: string;
84
-
85
- /**
86
- * Hide vertical scroll indicator (default: false)
87
- */
88
- hideScrollIndicator?: boolean;
89
-
90
- /**
91
- * Enable keyboard avoiding behavior (default: false)
92
- * Useful for screens with inputs
93
- */
94
- keyboardAvoiding?: boolean;
95
-
96
- }
97
-
98
- export const ScreenLayout: React.FC<ScreenLayoutProps> = ({
99
- children,
100
- scrollable = true,
101
- edges = ['top'],
102
- header,
103
- footer,
104
- backgroundColor,
105
- containerStyle,
106
- contentContainerStyle,
107
- testID,
108
- hideScrollIndicator = false,
109
- keyboardAvoiding = false,
110
- }) => {
111
- // Automatically uses current theme from global store
112
- const tokens = useAppDesignTokens();
113
- const styles = useMemo(() => getStyles(tokens), [tokens]);
114
-
115
- const bgColor = backgroundColor || tokens.colors.backgroundPrimary;
116
-
117
- // Non-scrollable layout
118
- if (!scrollable) {
119
- return (
120
- <SafeAreaView
121
- style={[styles.container, { backgroundColor: bgColor }, containerStyle]}
122
- edges={edges}
123
- testID={testID}
124
- >
125
- {header}
126
- <View style={[styles.content, contentContainerStyle]}>
127
- {children}
128
- </View>
129
- {footer}
130
- </SafeAreaView>
131
- );
132
- }
133
-
134
- // Scrollable layout (default)
135
- return (
136
- <SafeAreaView
137
- style={[styles.container, { backgroundColor: bgColor }, containerStyle]}
138
- edges={edges}
139
- testID={testID}
140
- >
141
- {header}
142
- <ScrollView
143
- style={styles.scrollView}
144
- contentContainerStyle={[styles.scrollContent, contentContainerStyle]}
145
- showsVerticalScrollIndicator={!hideScrollIndicator}
146
- keyboardShouldPersistTaps={keyboardAvoiding ? 'handled' : 'never'}
147
- >
148
- {children}
149
- </ScrollView>
150
- {footer}
151
- </SafeAreaView>
152
- );
153
- };
154
-
155
- const getStyles = (tokens: ReturnType<typeof useAppDesignTokens>) =>
156
- StyleSheet.create({
157
- container: {
158
- flex: 1,
159
- },
160
- content: {
161
- flex: 1,
162
- },
163
- scrollView: {
164
- flex: 1,
165
- },
166
- scrollContent: {
167
- flexGrow: 1,
168
- paddingHorizontal: tokens.spacing.md,
169
- paddingBottom: tokens.spacing.lg,
170
- },
171
- });
@@ -1,25 +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
-
10
- // Component exports
11
- // AppHeader - Main application header with navigation
12
- export { AppHeader } from './AppHeader';
13
-
14
- // ScreenLayout - Universal screen container with consistent layout
15
- export { ScreenLayout } from './ScreenLayout';
16
-
17
- // Type exports
18
- export type { AppHeaderProps } from './AppHeader';
19
- export type { ScreenLayoutProps } from './ScreenLayout';
20
-
21
- // Union type for all organism props (used for type narrowing)
22
- import type { AppHeaderProps } from './AppHeader';
23
- import type { ScreenLayoutProps } from './ScreenLayout';
24
-
25
- export type OrganismComponentProps = AppHeaderProps | ScreenLayoutProps;
@@ -1,124 +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
- /**
9
- * iOS Human Interface Guidelines (HIG) Constants
10
- *
11
- * @see https://developer.apple.com/design/human-interface-guidelines/layout
12
- */
13
- export const IOS_HIG = {
14
- /**
15
- * Minimum Touch Target Size
16
- *
17
- * Apple requires a minimum tappable area of 44pt x 44pt for ALL interactive controls.
18
- * This is enforced during App Store review.
19
- *
20
- * @critical Violating this can result in App Store rejection
21
- */
22
- MIN_TOUCH_TARGET: 44,
23
-
24
- /**
25
- * Recommended Minimum Touch Target Size
26
- *
27
- * For better accessibility and usability, Apple recommends 48pt x 48pt.
28
- */
29
- RECOMMENDED_TOUCH_TARGET: 48,
30
-
31
- /**
32
- * Minimum Text Size
33
- *
34
- * Minimum font size for body text to ensure readability.
35
- */
36
- MIN_TEXT_SIZE: 17,
37
-
38
- /**
39
- * Minimum Contrast Ratio
40
- *
41
- * WCAG AA compliance requires 4.5:1 for normal text.
42
- */
43
- MIN_CONTRAST_RATIO: 4.5,
44
- } as const;
45
-
46
- /**
47
- * Android Material Design Guidelines Constants
48
- *
49
- * @see https://m3.material.io/foundations/layout/applying-layout/window-size-classes
50
- */
51
- export const ANDROID_MATERIAL = {
52
- /**
53
- * Minimum Touch Target Size
54
- *
55
- * Material Design 3 recommends a minimum of 48dp x 48dp.
56
- */
57
- MIN_TOUCH_TARGET: 48,
58
-
59
- /**
60
- * Minimum Text Size
61
- *
62
- * Minimum font size for body text.
63
- */
64
- MIN_TEXT_SIZE: 14,
65
- } as const;
66
-
67
- /**
68
- * Universal Platform Constants
69
- *
70
- * These values work across both iOS and Android, taking the more restrictive requirement.
71
- */
72
- export const PLATFORM_CONSTANTS = {
73
- /**
74
- * Minimum Touch Target Size
75
- *
76
- * Uses iOS requirement (44pt) as it's more restrictive than Android (48dp).
77
- * This ensures compliance on both platforms.
78
- */
79
- MIN_TOUCH_TARGET: Math.max(IOS_HIG.MIN_TOUCH_TARGET, ANDROID_MATERIAL.MIN_TOUCH_TARGET),
80
-
81
- /**
82
- * Recommended Touch Target Size
83
- *
84
- * Uses the higher value between iOS and Android recommendations.
85
- */
86
- RECOMMENDED_TOUCH_TARGET: 48,
87
-
88
- /**
89
- * Minimum Text Size
90
- *
91
- * Uses iOS requirement as it's larger.
92
- */
93
- MIN_TEXT_SIZE: Math.max(IOS_HIG.MIN_TEXT_SIZE, ANDROID_MATERIAL.MIN_TEXT_SIZE),
94
- } as const;
95
-
96
- /**
97
- * Helper function to validate touch target size
98
- *
99
- * @param size - The size to validate (in pt/dp)
100
- * @returns true if size meets platform requirements
101
- */
102
- export const isValidTouchTarget = (size: number): boolean => {
103
- return size >= IOS_HIG.MIN_TOUCH_TARGET;
104
- };
105
-
106
- /**
107
- * Helper function to get minimum touch target for component
108
- *
109
- * @param componentType - The type of component ('button' | 'input' | 'icon' | 'generic')
110
- * @returns The minimum touch target size for that component type
111
- */
112
- export const getMinTouchTarget = (componentType: 'button' | 'input' | 'icon' | 'generic' = 'generic'): number => {
113
- switch (componentType) {
114
- case 'button':
115
- return PLATFORM_CONSTANTS.RECOMMENDED_TOUCH_TARGET; // 48pt recommended for buttons
116
- case 'input':
117
- return PLATFORM_CONSTANTS.RECOMMENDED_TOUCH_TARGET; // 48pt recommended for inputs
118
- case 'icon':
119
- return IOS_HIG.MIN_TOUCH_TARGET; // 44pt minimum for icon buttons
120
- case 'generic':
121
- default:
122
- return IOS_HIG.MIN_TOUCH_TARGET; // 44pt minimum for all other interactive elements
123
- }
124
- };