@umituz/react-native-design-system 1.0.0

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 (80) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +157 -0
  3. package/package.json +43 -0
  4. package/src/index.ts +345 -0
  5. package/src/presentation/atoms/AtomicAvatar.tsx +157 -0
  6. package/src/presentation/atoms/AtomicAvatarGroup.tsx +169 -0
  7. package/src/presentation/atoms/AtomicBadge.tsx +232 -0
  8. package/src/presentation/atoms/AtomicButton.tsx +124 -0
  9. package/src/presentation/atoms/AtomicCard.tsx +112 -0
  10. package/src/presentation/atoms/AtomicChip.tsx +223 -0
  11. package/src/presentation/atoms/AtomicDatePicker.tsx +347 -0
  12. package/src/presentation/atoms/AtomicDivider.tsx +114 -0
  13. package/src/presentation/atoms/AtomicFab.tsx +104 -0
  14. package/src/presentation/atoms/AtomicFilter.tsx +154 -0
  15. package/src/presentation/atoms/AtomicFormError.tsx +105 -0
  16. package/src/presentation/atoms/AtomicIcon.tsx +29 -0
  17. package/src/presentation/atoms/AtomicImage.tsx +149 -0
  18. package/src/presentation/atoms/AtomicInput.tsx +232 -0
  19. package/src/presentation/atoms/AtomicNumberInput.tsx +182 -0
  20. package/src/presentation/atoms/AtomicPicker.tsx +458 -0
  21. package/src/presentation/atoms/AtomicProgress.tsx +143 -0
  22. package/src/presentation/atoms/AtomicSearchBar.tsx +114 -0
  23. package/src/presentation/atoms/AtomicSkeleton.tsx +146 -0
  24. package/src/presentation/atoms/AtomicSort.tsx +145 -0
  25. package/src/presentation/atoms/AtomicSwitch.tsx +166 -0
  26. package/src/presentation/atoms/AtomicText.tsx +50 -0
  27. package/src/presentation/atoms/AtomicTextArea.tsx +198 -0
  28. package/src/presentation/atoms/AtomicTouchable.tsx +233 -0
  29. package/src/presentation/atoms/fab/styles/fabStyles.ts +69 -0
  30. package/src/presentation/atoms/fab/types/index.ts +88 -0
  31. package/src/presentation/atoms/filter/styles/filterStyles.ts +32 -0
  32. package/src/presentation/atoms/filter/types/index.ts +89 -0
  33. package/src/presentation/atoms/index.ts +378 -0
  34. package/src/presentation/atoms/input/hooks/useInputState.ts +15 -0
  35. package/src/presentation/atoms/input/styles/inputStyles.ts +66 -0
  36. package/src/presentation/atoms/input/types/index.ts +25 -0
  37. package/src/presentation/atoms/picker/styles/pickerStyles.ts +200 -0
  38. package/src/presentation/atoms/picker/types/index.ts +40 -0
  39. package/src/presentation/atoms/touchable/styles/touchableStyles.ts +71 -0
  40. package/src/presentation/atoms/touchable/types/index.ts +162 -0
  41. package/src/presentation/hooks/useAppDesignTokens.ts +78 -0
  42. package/src/presentation/hooks/useResponsive.ts +180 -0
  43. package/src/presentation/loading/index.ts +40 -0
  44. package/src/presentation/loading/presentation/components/LoadingSpinner.tsx +116 -0
  45. package/src/presentation/loading/presentation/components/LoadingState.tsx +200 -0
  46. package/src/presentation/loading/presentation/hooks/useLoading.ts +100 -0
  47. package/src/presentation/molecules/AtomicConfirmationModal.tsx +263 -0
  48. package/src/presentation/molecules/EmptyState.tsx +130 -0
  49. package/src/presentation/molecules/FormField.tsx +128 -0
  50. package/src/presentation/molecules/GridContainer.tsx +124 -0
  51. package/src/presentation/molecules/IconContainer.tsx +94 -0
  52. package/src/presentation/molecules/LanguageSwitcher.tsx +42 -0
  53. package/src/presentation/molecules/ListItem.tsx +36 -0
  54. package/src/presentation/molecules/ScreenHeader.tsx +140 -0
  55. package/src/presentation/molecules/SearchBar.tsx +85 -0
  56. package/src/presentation/molecules/SectionCard.tsx +74 -0
  57. package/src/presentation/molecules/SectionContainer.tsx +106 -0
  58. package/src/presentation/molecules/SectionHeader.tsx +125 -0
  59. package/src/presentation/molecules/confirmation-modal/styles/confirmationModalStyles.ts +133 -0
  60. package/src/presentation/molecules/confirmation-modal/types/index.ts +107 -0
  61. package/src/presentation/molecules/index.ts +42 -0
  62. package/src/presentation/molecules/languageswitcher/config/languageSwitcherConfig.ts +5 -0
  63. package/src/presentation/molecules/languageswitcher/hooks/useLanguageNavigation.ts +15 -0
  64. package/src/presentation/molecules/listitem/styles/listItemStyles.ts +19 -0
  65. package/src/presentation/molecules/listitem/types/index.ts +17 -0
  66. package/src/presentation/organisms/AppHeader.tsx +136 -0
  67. package/src/presentation/organisms/FormContainer.tsx +180 -0
  68. package/src/presentation/organisms/ScreenLayout.tsx +209 -0
  69. package/src/presentation/organisms/index.ts +25 -0
  70. package/src/presentation/tokens/AppDesignTokens.ts +57 -0
  71. package/src/presentation/tokens/commonStyles.ts +253 -0
  72. package/src/presentation/tokens/core/BaseTokens.ts +394 -0
  73. package/src/presentation/tokens/core/ColorPalette.ts +398 -0
  74. package/src/presentation/tokens/core/TokenFactory.ts +120 -0
  75. package/src/presentation/utils/platformConstants.ts +124 -0
  76. package/src/presentation/utils/responsive.ts +516 -0
  77. package/src/presentation/utils/variants/compound.ts +29 -0
  78. package/src/presentation/utils/variants/core.ts +39 -0
  79. package/src/presentation/utils/variants/helpers.ts +13 -0
  80. package/src/presentation/utils/variants.ts +3 -0
@@ -0,0 +1,128 @@
1
+ /**
2
+ * FormField Molecule - Complete Form Input with Label and Error
3
+ *
4
+ * Combines AtomicText (label/error) + AtomicInput (field)
5
+ * Theme: {{THEME_NAME}} ({{CATEGORY}} category)
6
+ *
7
+ * Atomic Design Level: MOLECULE
8
+ * Composition: AtomicText + AtomicInput
9
+ */
10
+
11
+ import React from 'react';
12
+ import { View, ViewStyle } from 'react-native';
13
+ import { useAppDesignTokens } from '../hooks/useAppDesignTokens';
14
+ import { AtomicText } from '../atoms/AtomicText';
15
+ import { AtomicInput, AtomicInputProps } from '../atoms/AtomicInput';
16
+
17
+ // =============================================================================
18
+ // TYPE DEFINITIONS
19
+ // =============================================================================
20
+
21
+ export interface FormFieldProps extends Omit<AtomicInputProps, 'state' | 'label'> {
22
+ label?: string;
23
+ error?: string;
24
+ helperText?: string;
25
+ required?: boolean;
26
+ containerStyle?: ViewStyle;
27
+ style?: ViewStyle; // Alias for containerStyle (for convenience)
28
+ }
29
+
30
+ // =============================================================================
31
+ // COMPONENT IMPLEMENTATION
32
+ // =============================================================================
33
+
34
+ export const FormField: React.FC<FormFieldProps> = ({
35
+ label,
36
+ error,
37
+ helperText,
38
+ required = false,
39
+ containerStyle,
40
+ style, // Accept both style and containerStyle
41
+ ...inputProps
42
+ }) => {
43
+ const tokens = useAppDesignTokens();
44
+ const inputState = error ? 'error' : 'default';
45
+
46
+ const styles = getStyles(tokens);
47
+
48
+ return (
49
+ <View style={[styles.container, containerStyle || style]}>
50
+ {/* Label */}
51
+ {label && (
52
+ <View style={styles.labelContainer}>
53
+ <AtomicText type="labelMedium" color="primary" style={styles.label}>
54
+ {label}
55
+ </AtomicText>
56
+ {required && (
57
+ <AtomicText type="labelMedium" color="error">
58
+ {' *'}
59
+ </AtomicText>
60
+ )}
61
+ </View>
62
+ )}
63
+
64
+ {/* Input Field */}
65
+ <AtomicInput
66
+ {...inputProps}
67
+ label={label || ''}
68
+ state={inputState}
69
+ />
70
+
71
+ {/* Error Message */}
72
+ {error && (
73
+ <AtomicText
74
+ type="bodySmall"
75
+
76
+ color="error"
77
+ style={styles.errorText}
78
+ >
79
+ {error}
80
+ </AtomicText>
81
+ )}
82
+
83
+ {/* Helper Text */}
84
+ {!error && helperText && (
85
+ <AtomicText
86
+ type="bodySmall"
87
+
88
+ color="secondary"
89
+ style={styles.helperText}
90
+ >
91
+ {helperText}
92
+ </AtomicText>
93
+ )}
94
+ </View>
95
+ );
96
+ };
97
+
98
+ // =============================================================================
99
+ // STYLES
100
+ // =============================================================================
101
+
102
+ const getStyles = (tokens: ReturnType<typeof useAppDesignTokens>) => ({
103
+ container: {
104
+ marginBottom: tokens.spacing.md,
105
+ } as ViewStyle,
106
+ labelContainer: {
107
+ flexDirection: 'row',
108
+ marginBottom: tokens.spacing.sm,
109
+ } as ViewStyle,
110
+ label: {
111
+ fontWeight: tokens.typography.labelMedium.fontWeight,
112
+ color: tokens.colors.textPrimary,
113
+ } as ViewStyle,
114
+ inputError: {
115
+ borderColor: tokens.colors.error,
116
+ } as ViewStyle,
117
+ errorText: {
118
+ marginTop: tokens.spacing.xs,
119
+ } as ViewStyle,
120
+ helperText: {
121
+ marginTop: tokens.spacing.xs,
122
+ } as ViewStyle,
123
+ });
124
+
125
+ // =============================================================================
126
+ // EXPORTS
127
+ // =============================================================================
128
+
@@ -0,0 +1,124 @@
1
+ /**
2
+ * GridContainer Molecule - Responsive Grid Layout
3
+ *
4
+ * Provides flexible grid layout with configurable columns and gap
5
+ * Theme: {{THEME_NAME}} ({{CATEGORY}} category)
6
+ *
7
+ * Atomic Design Level: MOLECULE
8
+ * Composition: View + Responsive Layout
9
+ *
10
+ * Usage:
11
+ * - Stats grids (2 columns)
12
+ * - Action grids (2 columns)
13
+ * - Product grids (2-3 columns)
14
+ * - Gallery grids (3-4 columns)
15
+ */
16
+
17
+ import React from 'react';
18
+ import { View, StyleSheet, ViewStyle, DimensionValue } from 'react-native';
19
+
20
+ // =============================================================================
21
+ // TYPE DEFINITIONS
22
+ // =============================================================================
23
+
24
+ export interface GridContainerProps {
25
+ /** Number of columns (default: 2) */
26
+ columns?: 2 | 3 | 4;
27
+ /** Gap between items in pixels (default: 8) */
28
+ gap?: number;
29
+ /** Container style override */
30
+ style?: ViewStyle;
31
+ /** Grid items to render */
32
+ children: React.ReactNode;
33
+ }
34
+
35
+ export interface GridItemProps {
36
+ /** Item content */
37
+ children: React.ReactNode;
38
+ /** Item style override */
39
+ style?: ViewStyle;
40
+ }
41
+
42
+ // =============================================================================
43
+ // COMPONENT IMPLEMENTATION
44
+ // =============================================================================
45
+
46
+ const GridContainerComponent: React.FC<GridContainerProps> = ({
47
+ columns = 2,
48
+ gap = 8,
49
+ style,
50
+ children,
51
+ }) => {
52
+ const styles = getStyles(gap);
53
+
54
+ return (
55
+ <View style={[styles.container, style]}>
56
+ {React.Children.map(children, (child) => {
57
+ if (React.isValidElement<GridItemProps>(child)) {
58
+ const childStyle = child.props.style;
59
+ const itemStyle = getItemStyle(columns, gap);
60
+ return React.cloneElement(child, {
61
+ style: StyleSheet.flatten([itemStyle, childStyle]),
62
+ });
63
+ }
64
+ return child;
65
+ })}
66
+ </View>
67
+ );
68
+ };
69
+
70
+ // =============================================================================
71
+ // GRID ITEM COMPONENT
72
+ // =============================================================================
73
+
74
+ export const GridItem: React.FC<GridItemProps> = ({ children, style }) => {
75
+ return <View style={style}>{children}</View>;
76
+ };
77
+
78
+ // Export GridContainer with Item property
79
+ export const GridContainer = GridContainerComponent as typeof GridContainerComponent & {
80
+ Item: typeof GridItem;
81
+ };
82
+
83
+ // Attach GridItem to GridContainer for convenient usage
84
+ GridContainer.Item = GridItem;
85
+
86
+ // =============================================================================
87
+ // HELPERS
88
+ // =============================================================================
89
+
90
+ const getItemStyle = (columns: number, gap: number): ViewStyle => {
91
+ // Calculate width: (100% - total gap space) / columns
92
+ // For 2 columns with 8px gap: (100% - 8px) / 2 = ~48%
93
+ // For 3 columns with 8px gap: (100% - 16px) / 3 = ~31.33%
94
+
95
+ const widthMap: Record<number, DimensionValue> = {
96
+ 2: '48%' as DimensionValue,
97
+ 3: '31.33%' as DimensionValue,
98
+ 4: '23%' as DimensionValue,
99
+ };
100
+
101
+ return {
102
+ width: widthMap[columns] || ('48%' as DimensionValue),
103
+ marginHorizontal: gap / 2,
104
+ marginBottom: gap * 1.5,
105
+ };
106
+ };
107
+
108
+ // =============================================================================
109
+ // STYLES
110
+ // =============================================================================
111
+
112
+ const getStyles = (gap: number) =>
113
+ StyleSheet.create({
114
+ container: {
115
+ flexDirection: 'row' as const,
116
+ flexWrap: 'wrap' as const,
117
+ marginHorizontal: -(gap / 2),
118
+ },
119
+ });
120
+
121
+ // =============================================================================
122
+ // EXPORTS
123
+ // =============================================================================
124
+
@@ -0,0 +1,94 @@
1
+ /**
2
+ * IconContainer Molecule Component
3
+ *
4
+ * Standardized icon container with consistent sizing and styling.
5
+ * Used throughout app for icon displays in lists, cards, and settings.
6
+ *
7
+ * Features:
8
+ * - Consistent sizing system
9
+ * - Optional background circle
10
+ * - Optional gradient background
11
+ * - Theme-aware colors
12
+ * - Accessibility support
13
+ *
14
+ * Atomic Design: Molecule (View + Icon)
15
+ */
16
+
17
+ import React from 'react';
18
+ import { View, StyleSheet } from 'react-native';
19
+ import { useAppDesignTokens } from '../hooks/useAppDesignTokens';
20
+ import { LinearGradient } from 'expo-linear-gradient';
21
+
22
+ interface IconContainerProps {
23
+ icon: React.ReactNode;
24
+ size?: 'sm' | 'md' | 'lg' | 'xl';
25
+ backgroundColor?: string;
26
+ gradient?: string[];
27
+ withBorder?: boolean;
28
+ borderColor?: string;
29
+ style?: object;
30
+ testID?: string;
31
+ }
32
+
33
+ const getSizeMap = (tokens: ReturnType<typeof useAppDesignTokens>) => ({
34
+ sm: tokens.iconSizes.sm,
35
+ md: tokens.iconSizes.md,
36
+ lg: tokens.iconSizes.lg,
37
+ xl: tokens.iconSizes.xl,
38
+ });
39
+
40
+ export const IconContainer: React.FC<IconContainerProps> = ({
41
+ icon,
42
+ size = 'md',
43
+ backgroundColor,
44
+ gradient,
45
+ withBorder = false,
46
+ borderColor,
47
+ style,
48
+ testID,
49
+ }) => {
50
+ const tokens = useAppDesignTokens();
51
+ const sizeMap = getSizeMap(tokens);
52
+ const containerSize = sizeMap[size];
53
+ const borderRadius = containerSize / 2;
54
+
55
+ const containerStyle = [
56
+ styles.container,
57
+ {
58
+ width: containerSize,
59
+ height: containerSize,
60
+ borderRadius,
61
+ backgroundColor: backgroundColor || (gradient ? undefined : tokens.colors.surfaceVariant),
62
+ },
63
+ withBorder && {
64
+ borderWidth: 1,
65
+ borderColor: borderColor || tokens.colors.border,
66
+ },
67
+ style,
68
+ ];
69
+
70
+ if (gradient) {
71
+ return (
72
+ <LinearGradient
73
+ colors={gradient}
74
+ style={containerStyle}
75
+ testID={testID}
76
+ >
77
+ {icon}
78
+ </LinearGradient>
79
+ );
80
+ }
81
+
82
+ return (
83
+ <View style={containerStyle} testID={testID}>
84
+ {icon}
85
+ </View>
86
+ );
87
+ };
88
+
89
+ const styles = StyleSheet.create({
90
+ container: {
91
+ alignItems: 'center',
92
+ justifyContent: 'center',
93
+ },
94
+ });
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import { TouchableOpacity, StyleSheet } from 'react-native';
3
+ import { AtomicText, AtomicIcon } from '../atoms';
4
+ import { useAppDesignTokens } from '../hooks/useAppDesignTokens';
5
+ import { useLanguageNavigation } from './languageswitcher/hooks/useLanguageNavigation';
6
+ import { languageSwitcherConfig } from './languageswitcher/config/languageSwitcherConfig';
7
+
8
+ interface LanguageSwitcherProps {
9
+ showName?: boolean;
10
+ showFlag?: boolean;
11
+ color?: string;
12
+ navigationScreen?: string;
13
+ }
14
+
15
+ export const LanguageSwitcher: React.FC<LanguageSwitcherProps> = ({
16
+ showName = false,
17
+ showFlag = true,
18
+ color,
19
+ navigationScreen = languageSwitcherConfig.defaultNavigationScreen,
20
+ }) => {
21
+ const tokens = useAppDesignTokens();
22
+ const { currentLang, navigateToLanguageSelection } = useLanguageNavigation(navigationScreen);
23
+ const iconColor = color || tokens.colors.textPrimary;
24
+
25
+ const styles = getStyles(tokens);
26
+
27
+ return (
28
+ <TouchableOpacity style={styles.container} onPress={navigateToLanguageSelection} activeOpacity={0.7} hitSlop={languageSwitcherConfig.hitSlop}>
29
+ {showFlag && <AtomicText type="headlineSmall" style={styles.flag}>{currentLang.flag}</AtomicText>}
30
+ {showName && <AtomicText type="bodySmall" color={iconColor} style={styles.languageName}>{currentLang.nativeName}</AtomicText>}
31
+ {!showName && !showFlag && <AtomicIcon name="Languages" color="primary" />}
32
+ </TouchableOpacity>
33
+ );
34
+ };
35
+
36
+ const getStyles = (tokens: ReturnType<typeof useAppDesignTokens>) => ({
37
+ container: { flexDirection: 'row' as const, alignItems: 'center' as const, gap: tokens.spacing.sm, paddingHorizontal: tokens.spacing.xs },
38
+ flag: { fontSize: tokens.typography.headingSmall.fontSize },
39
+ languageName: { fontSize: tokens.typography.bodySmall.fontSize, fontWeight: tokens.typography.semibold },
40
+ });
41
+
42
+ export default LanguageSwitcher;
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import { TouchableOpacity, View } from 'react-native';
3
+ import { useAppDesignTokens } from '../hooks/useAppDesignTokens';
4
+ import { AtomicText } from '../atoms/AtomicText';
5
+ import { AtomicIcon } from '../atoms/AtomicIcon';
6
+ import { ListItemProps } from './listitem/types';
7
+ import { getListItemStyles } from './listitem/styles/listItemStyles';
8
+
9
+ export type { ListItemProps };
10
+
11
+ export const ListItem: React.FC<ListItemProps> = ({
12
+ title, subtitle, leftIcon, rightIcon = 'forward', onPress, disabled = false, style,
13
+ }) => {
14
+ const tokens = useAppDesignTokens();
15
+ const listItemStyles = getListItemStyles(tokens);
16
+ const Component: React.ComponentType<any> = onPress ? TouchableOpacity : View;
17
+
18
+ return (
19
+ <Component style={[listItemStyles.container, disabled && listItemStyles.disabled, style]} onPress={onPress} disabled={disabled} activeOpacity={0.7}>
20
+ {leftIcon && (
21
+ <View style={listItemStyles.iconContainer}>
22
+ <AtomicIcon name={leftIcon} color={disabled ? 'surfaceVariant' : 'primary'} />
23
+ </View>
24
+ )}
25
+ <View style={listItemStyles.content}>
26
+ <AtomicText type="bodyLarge" color={disabled ? 'surfaceVariant' : 'onSurface'} numberOfLines={1}>{title}</AtomicText>
27
+ {subtitle && <AtomicText type="bodySmall" color={disabled ? 'surfaceVariant' : 'surfaceVariant'} numberOfLines={2} style={listItemStyles.subtitle}>{subtitle}</AtomicText>}
28
+ </View>
29
+ {rightIcon && onPress && (
30
+ <View style={listItemStyles.iconContainer}>
31
+ <AtomicIcon name={rightIcon} color={disabled ? 'surfaceVariant' : 'surfaceVariant'} />
32
+ </View>
33
+ )}
34
+ </Component>
35
+ );
36
+ };
@@ -0,0 +1,140 @@
1
+ /**
2
+ * ScreenHeader Component - {{APP_NAME}}
3
+ *
4
+ * Reusable screen header with consistent back button placement
5
+ * Theme: {{THEME_NAME}} ({{CATEGORY}} category)
6
+ *
7
+ * Features:
8
+ * - Top-left back button (arrow-back icon)
9
+ * - Centered title text
10
+ * - Optional right action button
11
+ * - Consistent spacing and layout
12
+ * - Works with all 100+ generated apps
13
+ *
14
+ * CRITICAL: Back button MUST ALWAYS be top-left (never bottom, never center)
15
+ */
16
+
17
+ import React from 'react';
18
+ import { View, StyleSheet, TouchableOpacity, ViewStyle } from 'react-native';
19
+ import { useNavigation } from '@react-navigation/native';
20
+ import { AtomicIcon } from '../atoms/AtomicIcon';
21
+ import { AtomicText } from '../atoms/AtomicText';
22
+ import { useAppDesignTokens } from '../hooks/useAppDesignTokens';
23
+
24
+ export interface ScreenHeaderProps {
25
+ /** Screen title (centered) */
26
+ title: string;
27
+
28
+ /** Optional right action button */
29
+ rightAction?: React.ReactNode;
30
+
31
+ /** Custom back button action (default: navigation.goBack()) */
32
+ onBackPress?: () => void;
33
+
34
+ /** Hide back button (rare cases only) */
35
+ hideBackButton?: boolean;
36
+
37
+ /** Additional header style */
38
+ style?: ViewStyle;
39
+
40
+ /** Test ID for E2E testing */
41
+ testID?: string;
42
+ }
43
+
44
+ /**
45
+ * ScreenHeader Component
46
+ *
47
+ * @example
48
+ * // Basic usage (most common)
49
+ * <ScreenHeader title="Settings" />
50
+ *
51
+ * @example
52
+ * // With right action
53
+ * <ScreenHeader
54
+ * title="Edit Profile"
55
+ * rightAction={<TouchableOpacity onPress={handleSave}><Text>Save</Text></TouchableOpacity>}
56
+ * />
57
+ *
58
+ * @example
59
+ * // Custom back action
60
+ * <ScreenHeader
61
+ * title="Unsaved Changes"
62
+ * onBackPress={handleUnsavedChanges}
63
+ * />
64
+ */
65
+ export const ScreenHeader: React.FC<ScreenHeaderProps> = ({
66
+ title,
67
+ rightAction,
68
+ onBackPress,
69
+ hideBackButton = false,
70
+ style,
71
+ testID = 'screen-header',
72
+ }) => {
73
+ const navigation = useNavigation();
74
+ const tokens = useAppDesignTokens();
75
+
76
+ const handleBackPress = () => {
77
+ if (onBackPress) {
78
+ onBackPress();
79
+ } else {
80
+ navigation.goBack();
81
+ }
82
+ };
83
+
84
+ return (
85
+ <View
86
+ style={[
87
+ {
88
+ flexDirection: 'row',
89
+ alignItems: 'center',
90
+ justifyContent: 'space-between',
91
+ paddingHorizontal: tokens.spacing.screenPadding,
92
+ paddingVertical: tokens.spacing.md,
93
+ borderBottomWidth: 0.5,
94
+ backgroundColor: tokens.colors.backgroundPrimary,
95
+ borderBottomColor: tokens.colors.border,
96
+ },
97
+ style
98
+ ]}
99
+ testID={testID}
100
+ >
101
+ {/* Left: Back Button (ALWAYS top-left when visible) */}
102
+ <View style={{ width: 40, alignItems: 'flex-start' }}>
103
+ {!hideBackButton && (
104
+ <TouchableOpacity
105
+ onPress={handleBackPress}
106
+ hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
107
+ testID={`${testID}-back-button`}
108
+ >
109
+ <AtomicIcon name="arrow-back" color="primary" />
110
+ </TouchableOpacity>
111
+ )}
112
+ </View>
113
+
114
+ {/* Center: Title */}
115
+ <View style={{ flex: 1, alignItems: 'center', paddingHorizontal: tokens.spacing.sm }}>
116
+ <AtomicText
117
+ type="headlineMedium"
118
+ style={[
119
+ {
120
+ fontWeight: tokens.typography.bold,
121
+ textAlign: 'center',
122
+ color: tokens.colors.textPrimary,
123
+ }
124
+ ]}
125
+ numberOfLines={1}
126
+ testID={`${testID}-title`}
127
+ >
128
+ {title}
129
+ </AtomicText>
130
+ </View>
131
+
132
+ {/* Right: Optional Action or Placeholder */}
133
+ <View style={{ width: 40, alignItems: 'flex-start' }}>
134
+ {rightAction || <View style={{ width: 40 }} />}
135
+ </View>
136
+ </View>
137
+ );
138
+ };
139
+
140
+ export default ScreenHeader;
@@ -0,0 +1,85 @@
1
+ /**
2
+ * SearchBar Molecule - Search Input with Icon and Clear Button
3
+ *
4
+ * Combines AtomicInput + AtomicIcon + AtomicButton
5
+ * Theme: {{THEME_NAME}} ({{CATEGORY}} category)
6
+ *
7
+ * Atomic Design Level: MOLECULE
8
+ * Composition: AtomicInput + AtomicIcon + TouchableOpacity
9
+ */
10
+
11
+ import React from 'react';
12
+ import { View, TouchableOpacity, ViewStyle } from 'react-native';
13
+ import { useAppDesignTokens } from '../hooks/useAppDesignTokens';
14
+ import { AtomicInput, AtomicInputProps } from '../atoms/AtomicInput';
15
+ import { AtomicIcon } from '../atoms/AtomicIcon';
16
+
17
+ // =============================================================================
18
+ // TYPE DEFINITIONS
19
+ // =============================================================================
20
+
21
+ export interface SearchBarProps extends Omit<AtomicInputProps, 'leftIcon' | 'rightIcon'> {
22
+ onClear?: () => void;
23
+ containerStyle?: ViewStyle;
24
+ }
25
+
26
+ // =============================================================================
27
+ // COMPONENT IMPLEMENTATION
28
+ // =============================================================================
29
+
30
+ export const SearchBar: React.FC<SearchBarProps> = ({
31
+ value,
32
+ onChangeText,
33
+ onClear,
34
+ placeholder = 'Search...',
35
+ containerStyle,
36
+ ...inputProps
37
+ }) => {
38
+ const tokens = useAppDesignTokens();
39
+
40
+ const handleClear = () => {
41
+ if (onChangeText) {
42
+ onChangeText('');
43
+ }
44
+ if (onClear) {
45
+ onClear();
46
+ }
47
+ };
48
+
49
+ const styles = getStyles(tokens);
50
+
51
+ return (
52
+ <View style={[styles.container, containerStyle]}>
53
+ <AtomicInput
54
+ {...inputProps}
55
+ value={value}
56
+ onChangeText={onChangeText}
57
+ placeholder={placeholder}
58
+ variant="filled"
59
+ style={styles.input}
60
+ leadingIcon="Search"
61
+ trailingIcon={value && value.length > 0 ? "X" : undefined}
62
+ onTrailingIconPress={value && value.length > 0 ? handleClear : undefined}
63
+ />
64
+ </View>
65
+ );
66
+ };
67
+
68
+ // =============================================================================
69
+ // STYLES
70
+ // =============================================================================
71
+
72
+ const getStyles = (tokens: ReturnType<typeof useAppDesignTokens>) => ({
73
+ container: {
74
+ width: '100%',
75
+ marginVertical: tokens.spacing.sm,
76
+ } as ViewStyle,
77
+ input: {
78
+ backgroundColor: tokens.colors.surfaceVariant,
79
+ } as ViewStyle,
80
+ });
81
+
82
+ // =============================================================================
83
+ // EXPORTS
84
+ // =============================================================================
85
+