@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.
- package/LICENSE +21 -0
- package/README.md +157 -0
- package/package.json +43 -0
- package/src/index.ts +345 -0
- package/src/presentation/atoms/AtomicAvatar.tsx +157 -0
- package/src/presentation/atoms/AtomicAvatarGroup.tsx +169 -0
- package/src/presentation/atoms/AtomicBadge.tsx +232 -0
- package/src/presentation/atoms/AtomicButton.tsx +124 -0
- package/src/presentation/atoms/AtomicCard.tsx +112 -0
- package/src/presentation/atoms/AtomicChip.tsx +223 -0
- package/src/presentation/atoms/AtomicDatePicker.tsx +347 -0
- package/src/presentation/atoms/AtomicDivider.tsx +114 -0
- package/src/presentation/atoms/AtomicFab.tsx +104 -0
- package/src/presentation/atoms/AtomicFilter.tsx +154 -0
- package/src/presentation/atoms/AtomicFormError.tsx +105 -0
- package/src/presentation/atoms/AtomicIcon.tsx +29 -0
- package/src/presentation/atoms/AtomicImage.tsx +149 -0
- package/src/presentation/atoms/AtomicInput.tsx +232 -0
- package/src/presentation/atoms/AtomicNumberInput.tsx +182 -0
- package/src/presentation/atoms/AtomicPicker.tsx +458 -0
- package/src/presentation/atoms/AtomicProgress.tsx +143 -0
- package/src/presentation/atoms/AtomicSearchBar.tsx +114 -0
- package/src/presentation/atoms/AtomicSkeleton.tsx +146 -0
- package/src/presentation/atoms/AtomicSort.tsx +145 -0
- package/src/presentation/atoms/AtomicSwitch.tsx +166 -0
- package/src/presentation/atoms/AtomicText.tsx +50 -0
- package/src/presentation/atoms/AtomicTextArea.tsx +198 -0
- package/src/presentation/atoms/AtomicTouchable.tsx +233 -0
- package/src/presentation/atoms/fab/styles/fabStyles.ts +69 -0
- package/src/presentation/atoms/fab/types/index.ts +88 -0
- package/src/presentation/atoms/filter/styles/filterStyles.ts +32 -0
- package/src/presentation/atoms/filter/types/index.ts +89 -0
- package/src/presentation/atoms/index.ts +378 -0
- package/src/presentation/atoms/input/hooks/useInputState.ts +15 -0
- package/src/presentation/atoms/input/styles/inputStyles.ts +66 -0
- package/src/presentation/atoms/input/types/index.ts +25 -0
- package/src/presentation/atoms/picker/styles/pickerStyles.ts +200 -0
- package/src/presentation/atoms/picker/types/index.ts +40 -0
- package/src/presentation/atoms/touchable/styles/touchableStyles.ts +71 -0
- package/src/presentation/atoms/touchable/types/index.ts +162 -0
- package/src/presentation/hooks/useAppDesignTokens.ts +78 -0
- package/src/presentation/hooks/useResponsive.ts +180 -0
- package/src/presentation/loading/index.ts +40 -0
- package/src/presentation/loading/presentation/components/LoadingSpinner.tsx +116 -0
- package/src/presentation/loading/presentation/components/LoadingState.tsx +200 -0
- package/src/presentation/loading/presentation/hooks/useLoading.ts +100 -0
- package/src/presentation/molecules/AtomicConfirmationModal.tsx +263 -0
- package/src/presentation/molecules/EmptyState.tsx +130 -0
- package/src/presentation/molecules/FormField.tsx +128 -0
- package/src/presentation/molecules/GridContainer.tsx +124 -0
- package/src/presentation/molecules/IconContainer.tsx +94 -0
- package/src/presentation/molecules/LanguageSwitcher.tsx +42 -0
- package/src/presentation/molecules/ListItem.tsx +36 -0
- package/src/presentation/molecules/ScreenHeader.tsx +140 -0
- package/src/presentation/molecules/SearchBar.tsx +85 -0
- package/src/presentation/molecules/SectionCard.tsx +74 -0
- package/src/presentation/molecules/SectionContainer.tsx +106 -0
- package/src/presentation/molecules/SectionHeader.tsx +125 -0
- package/src/presentation/molecules/confirmation-modal/styles/confirmationModalStyles.ts +133 -0
- package/src/presentation/molecules/confirmation-modal/types/index.ts +107 -0
- package/src/presentation/molecules/index.ts +42 -0
- package/src/presentation/molecules/languageswitcher/config/languageSwitcherConfig.ts +5 -0
- package/src/presentation/molecules/languageswitcher/hooks/useLanguageNavigation.ts +15 -0
- package/src/presentation/molecules/listitem/styles/listItemStyles.ts +19 -0
- package/src/presentation/molecules/listitem/types/index.ts +17 -0
- package/src/presentation/organisms/AppHeader.tsx +136 -0
- package/src/presentation/organisms/FormContainer.tsx +180 -0
- package/src/presentation/organisms/ScreenLayout.tsx +209 -0
- package/src/presentation/organisms/index.ts +25 -0
- package/src/presentation/tokens/AppDesignTokens.ts +57 -0
- package/src/presentation/tokens/commonStyles.ts +253 -0
- package/src/presentation/tokens/core/BaseTokens.ts +394 -0
- package/src/presentation/tokens/core/ColorPalette.ts +398 -0
- package/src/presentation/tokens/core/TokenFactory.ts +120 -0
- package/src/presentation/utils/platformConstants.ts +124 -0
- package/src/presentation/utils/responsive.ts +516 -0
- package/src/presentation/utils/variants/compound.ts +29 -0
- package/src/presentation/utils/variants/core.ts +39 -0
- package/src/presentation/utils/variants/helpers.ts +13 -0
- package/src/presentation/utils/variants.ts +3 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AppHeader Organism - Application Header Component
|
|
3
|
+
*
|
|
4
|
+
* Complex header combining atoms and molecules
|
|
5
|
+
* Theme: {{THEME_NAME}} ({{CATEGORY}} category)
|
|
6
|
+
*
|
|
7
|
+
* Atomic Design Level: ORGANISM
|
|
8
|
+
* Composition: AtomicIcon + AtomicText + AtomicButton + SearchBar
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { View, ViewStyle, SafeAreaView } from 'react-native';
|
|
13
|
+
import { useAppDesignTokens } from '../hooks/useAppDesignTokens';
|
|
14
|
+
import { AtomicText } from '../atoms/AtomicText';
|
|
15
|
+
import { AtomicButton } from '../atoms/AtomicButton';
|
|
16
|
+
import { AtomicIcon } from '../atoms/AtomicIcon';
|
|
17
|
+
|
|
18
|
+
// =============================================================================
|
|
19
|
+
// TYPE DEFINITIONS
|
|
20
|
+
// =============================================================================
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* AppHeader component props
|
|
24
|
+
*
|
|
25
|
+
* leftIcon/rightIcon: Any MaterialIcons name
|
|
26
|
+
* @see https://fonts.google.com/icons
|
|
27
|
+
*/
|
|
28
|
+
export interface AppHeaderProps {
|
|
29
|
+
title: string;
|
|
30
|
+
subtitle?: string;
|
|
31
|
+
leftIcon?: string; // MaterialIcons name
|
|
32
|
+
onLeftPress?: () => void;
|
|
33
|
+
rightIcon?: string; // MaterialIcons name
|
|
34
|
+
onRightPress?: () => void;
|
|
35
|
+
showShadow?: boolean;
|
|
36
|
+
backgroundColor?: string;
|
|
37
|
+
style?: ViewStyle;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// =============================================================================
|
|
41
|
+
// COMPONENT IMPLEMENTATION
|
|
42
|
+
// =============================================================================
|
|
43
|
+
|
|
44
|
+
export const AppHeader: React.FC<AppHeaderProps> = ({
|
|
45
|
+
title,
|
|
46
|
+
subtitle,
|
|
47
|
+
leftIcon,
|
|
48
|
+
onLeftPress,
|
|
49
|
+
rightIcon,
|
|
50
|
+
onRightPress,
|
|
51
|
+
showShadow = true,
|
|
52
|
+
backgroundColor,
|
|
53
|
+
style,
|
|
54
|
+
}) => {
|
|
55
|
+
const tokens = useAppDesignTokens();
|
|
56
|
+
const bgColor = backgroundColor || tokens.colors.surface;
|
|
57
|
+
const styles = getStyles(tokens);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<SafeAreaView style={[styles.safeArea, { backgroundColor: bgColor }]}>
|
|
61
|
+
<View style={[styles.container, { backgroundColor: bgColor }, style]}>
|
|
62
|
+
{/* Left Action */}
|
|
63
|
+
<View style={styles.leftContainer}>
|
|
64
|
+
{leftIcon && onLeftPress && (
|
|
65
|
+
<AtomicButton
|
|
66
|
+
variant="text"
|
|
67
|
+
size="sm"
|
|
68
|
+
onPress={onLeftPress}
|
|
69
|
+
icon={leftIcon}
|
|
70
|
+
/>
|
|
71
|
+
)}
|
|
72
|
+
</View>
|
|
73
|
+
|
|
74
|
+
{/* Title Section */}
|
|
75
|
+
<View style={styles.titleContainer}>
|
|
76
|
+
<AtomicText type="titleLarge" color="primary" numberOfLines={1}>
|
|
77
|
+
{title}
|
|
78
|
+
</AtomicText>
|
|
79
|
+
{subtitle && (
|
|
80
|
+
<AtomicText type="bodySmall" color="secondary" numberOfLines={1}>
|
|
81
|
+
{subtitle}
|
|
82
|
+
</AtomicText>
|
|
83
|
+
)}
|
|
84
|
+
</View>
|
|
85
|
+
|
|
86
|
+
{/* Right Action */}
|
|
87
|
+
<View style={styles.rightContainer}>
|
|
88
|
+
{rightIcon && onRightPress && (
|
|
89
|
+
<AtomicButton
|
|
90
|
+
variant="text"
|
|
91
|
+
size="sm"
|
|
92
|
+
onPress={onRightPress}
|
|
93
|
+
icon={rightIcon}
|
|
94
|
+
/>
|
|
95
|
+
)}
|
|
96
|
+
</View>
|
|
97
|
+
</View>
|
|
98
|
+
</SafeAreaView>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// =============================================================================
|
|
103
|
+
// STYLES
|
|
104
|
+
// =============================================================================
|
|
105
|
+
|
|
106
|
+
const getStyles = (tokens: ReturnType<typeof useAppDesignTokens>) => ({
|
|
107
|
+
safeArea: {
|
|
108
|
+
backgroundColor: tokens.colors.surface,
|
|
109
|
+
} as ViewStyle,
|
|
110
|
+
container: {
|
|
111
|
+
flexDirection: 'row' as const,
|
|
112
|
+
alignItems: 'center' as const,
|
|
113
|
+
justifyContent: 'space-between' as const,
|
|
114
|
+
paddingHorizontal: tokens.spacing.md,
|
|
115
|
+
paddingVertical: tokens.spacing.sm,
|
|
116
|
+
minHeight: tokens.iconSizes.xl + tokens.spacing.md,
|
|
117
|
+
} as ViewStyle,
|
|
118
|
+
leftContainer: {
|
|
119
|
+
width: tokens.iconSizes.xl + tokens.spacing.sm,
|
|
120
|
+
alignItems: 'flex-start' as const,
|
|
121
|
+
} as ViewStyle,
|
|
122
|
+
titleContainer: {
|
|
123
|
+
flex: 1,
|
|
124
|
+
alignItems: 'center' as const,
|
|
125
|
+
paddingHorizontal: tokens.spacing.sm,
|
|
126
|
+
} as ViewStyle,
|
|
127
|
+
rightContainer: {
|
|
128
|
+
width: tokens.iconSizes.xl + tokens.spacing.sm,
|
|
129
|
+
alignItems: 'flex-start' as const,
|
|
130
|
+
} as ViewStyle,
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// =============================================================================
|
|
134
|
+
// EXPORTS
|
|
135
|
+
// =============================================================================
|
|
136
|
+
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FormContainer Component
|
|
3
|
+
*
|
|
4
|
+
* A reusable container for forms with Material Design 3 integration,
|
|
5
|
+
* proper keyboard handling, and responsive layout.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Material Design 3 Surface component for elevation and theme integration
|
|
9
|
+
* - Universal keyboard handling (no platform-specific code)
|
|
10
|
+
* - ScrollView with automatic content padding
|
|
11
|
+
* - Safe area insets for bottom tab navigation overlap
|
|
12
|
+
* - Responsive max width for large screens (tablets)
|
|
13
|
+
* - Consistent vertical spacing between form elements
|
|
14
|
+
* - Theme-aware surface colors and elevation
|
|
15
|
+
* - Optimized performance with memoized styles
|
|
16
|
+
*
|
|
17
|
+
* Usage:
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <FormContainer>
|
|
20
|
+
* <AtomicInput label="Name" value={name} onChangeText={setName} />
|
|
21
|
+
* <AtomicTextArea label="Description" value={desc} onChangeText={setDesc} />
|
|
22
|
+
* <AtomicButton variant="primary" onPress={handleSubmit}>
|
|
23
|
+
* Submit
|
|
24
|
+
* </AtomicButton>
|
|
25
|
+
* </FormContainer>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* Why This Component:
|
|
29
|
+
* - Prevents keyboard from covering input fields (universal solution)
|
|
30
|
+
* - Handles safe area (notch, bottom tabs) automatically
|
|
31
|
+
* - Consistent form layout across all 100+ generated apps
|
|
32
|
+
* - Responsive design for tablets (max 700px) and phones (full width)
|
|
33
|
+
* - Automatic vertical spacing between form elements (no manual marginBottom)
|
|
34
|
+
* - Material Design 3 surface with proper elevation
|
|
35
|
+
* - Reduces boilerplate in form screens
|
|
36
|
+
* - Universal code - no platform checks, works on iOS, Android, Web
|
|
37
|
+
*
|
|
38
|
+
* Technical Details:
|
|
39
|
+
* - Uses ScrollView with contentContainerStyle for keyboard handling
|
|
40
|
+
* - React Native Paper Surface for Material Design 3 integration
|
|
41
|
+
* - Vertical spacing via Children.map() wrapping (universal compatibility)
|
|
42
|
+
* - Safe area insets from react-native-safe-area-context
|
|
43
|
+
* - Responsive values from useResponsive hook
|
|
44
|
+
*
|
|
45
|
+
* @module FormContainer
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
import React, { useMemo, Children } from 'react';
|
|
49
|
+
import {
|
|
50
|
+
ScrollView,
|
|
51
|
+
StyleSheet,
|
|
52
|
+
View,
|
|
53
|
+
StyleProp,
|
|
54
|
+
ViewStyle,
|
|
55
|
+
} from 'react-native';
|
|
56
|
+
import { Surface } from 'react-native-paper';
|
|
57
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
58
|
+
import { useAppDesignTokens } from '../hooks/useAppDesignTokens';
|
|
59
|
+
import { useResponsive } from '../hooks/useResponsive';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Props for FormContainer component
|
|
63
|
+
*/
|
|
64
|
+
export interface FormContainerProps {
|
|
65
|
+
/** Form content (inputs, buttons, etc.) */
|
|
66
|
+
children: React.ReactNode;
|
|
67
|
+
/** Container style override (for outer View) */
|
|
68
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
69
|
+
/** Content container style override (for ScrollView content) */
|
|
70
|
+
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
71
|
+
/** Show vertical scroll indicator */
|
|
72
|
+
showsVerticalScrollIndicator?: boolean;
|
|
73
|
+
/** Optional test ID for E2E testing */
|
|
74
|
+
testID?: string;
|
|
75
|
+
/** Disable Material Design elevation (default: false) */
|
|
76
|
+
disableElevation?: boolean;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* FormContainer - Universal form wrapper component
|
|
81
|
+
*
|
|
82
|
+
* Wraps forms with:
|
|
83
|
+
* - Material Design 3 Surface component
|
|
84
|
+
* - Universal keyboard handling (no platform checks)
|
|
85
|
+
* - ScrollView for content overflow
|
|
86
|
+
* - Safe area insets (bottom tabs, notch)
|
|
87
|
+
* - Responsive max width (tablets)
|
|
88
|
+
* - Theme integration
|
|
89
|
+
*/
|
|
90
|
+
export const FormContainer: React.FC<FormContainerProps> = ({
|
|
91
|
+
children,
|
|
92
|
+
containerStyle,
|
|
93
|
+
contentContainerStyle,
|
|
94
|
+
showsVerticalScrollIndicator = false,
|
|
95
|
+
testID,
|
|
96
|
+
disableElevation = false,
|
|
97
|
+
}) => {
|
|
98
|
+
const tokens = useAppDesignTokens();
|
|
99
|
+
const insets = useSafeAreaInsets();
|
|
100
|
+
const { formContentWidth, formBottomPadding, formElementSpacing } = useResponsive();
|
|
101
|
+
|
|
102
|
+
// Memoize styles to prevent recreation on every render
|
|
103
|
+
// Only recreate when theme colors or responsive values change
|
|
104
|
+
const styles = useMemo(
|
|
105
|
+
() =>
|
|
106
|
+
StyleSheet.create({
|
|
107
|
+
container: {
|
|
108
|
+
flex: 1,
|
|
109
|
+
backgroundColor: tokens.colors.backgroundPrimary,
|
|
110
|
+
},
|
|
111
|
+
surface: {
|
|
112
|
+
flex: 1,
|
|
113
|
+
backgroundColor: tokens.colors.surface,
|
|
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.spacing.lg,
|
|
139
|
+
tokens.spacing.xl,
|
|
140
|
+
formBottomPadding,
|
|
141
|
+
formContentWidth,
|
|
142
|
+
formElementSpacing,
|
|
143
|
+
insets.bottom,
|
|
144
|
+
]
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
// Wrap each child with spacing View (universal gap replacement)
|
|
148
|
+
// Children.map() handles arrays, fragments, single elements correctly
|
|
149
|
+
const childrenWithSpacing = useMemo(() => {
|
|
150
|
+
const childArray = Children.toArray(children);
|
|
151
|
+
return childArray.map((child, index) => (
|
|
152
|
+
<View
|
|
153
|
+
key={index}
|
|
154
|
+
style={index < childArray.length - 1 ? styles.formElementWrapper : undefined}
|
|
155
|
+
>
|
|
156
|
+
{child}
|
|
157
|
+
</View>
|
|
158
|
+
));
|
|
159
|
+
}, [children, styles.formElementWrapper]);
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<View style={[styles.container, containerStyle]} testID={testID}>
|
|
163
|
+
<Surface
|
|
164
|
+
style={styles.surface}
|
|
165
|
+
elevation={disableElevation ? 0 : 1}
|
|
166
|
+
>
|
|
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
|
+
</Surface>
|
|
178
|
+
</View>
|
|
179
|
+
);
|
|
180
|
+
};
|
|
@@ -0,0 +1,209 @@
|
|
|
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
|
+
* - Loading state support
|
|
8
|
+
* - Theme-aware background colors
|
|
9
|
+
* - Optional header/footer slots
|
|
10
|
+
* - Consistent spacing and padding
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* <ScreenLayout>
|
|
14
|
+
* <View>Your content here</View>
|
|
15
|
+
* </ScreenLayout>
|
|
16
|
+
*
|
|
17
|
+
* Advanced:
|
|
18
|
+
* <ScreenLayout
|
|
19
|
+
* scrollable={false}
|
|
20
|
+
* loading={isLoading}
|
|
21
|
+
* edges={['top', 'bottom']}
|
|
22
|
+
* header={<CustomHeader />}
|
|
23
|
+
* >
|
|
24
|
+
* <View>Content</View>
|
|
25
|
+
* </ScreenLayout>
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import React, { useMemo } from 'react';
|
|
29
|
+
import { View, ScrollView, StyleSheet, ViewStyle } from 'react-native';
|
|
30
|
+
import { SafeAreaView, Edge } from 'react-native-safe-area-context';
|
|
31
|
+
import { useAppDesignTokens } from '../hooks/useAppDesignTokens';
|
|
32
|
+
import { LoadingState } from '../loading/presentation/components/LoadingState';
|
|
33
|
+
|
|
34
|
+
export interface ScreenLayoutProps {
|
|
35
|
+
/**
|
|
36
|
+
* Content to render inside the layout
|
|
37
|
+
*/
|
|
38
|
+
children: React.ReactNode;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Enable scrolling (default: true)
|
|
42
|
+
* Set to false for screens with custom scroll logic
|
|
43
|
+
*/
|
|
44
|
+
scrollable?: boolean;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Safe area edges to apply (default: ['top'])
|
|
48
|
+
* Common values:
|
|
49
|
+
* - ['top'] - For screens with bottom tabs
|
|
50
|
+
* - ['top', 'bottom'] - For modal screens
|
|
51
|
+
* - [] - No safe area (use cautiously)
|
|
52
|
+
*/
|
|
53
|
+
edges?: Edge[];
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Show loading state
|
|
57
|
+
* When true, displays LoadingState component
|
|
58
|
+
*/
|
|
59
|
+
loading?: boolean;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Loading icon name (default: 'settings')
|
|
63
|
+
*/
|
|
64
|
+
loadingIcon?: string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Loading message (default: 'Loading...')
|
|
68
|
+
*/
|
|
69
|
+
loadingMessage?: string;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Optional header component
|
|
73
|
+
* Rendered above scrollable content
|
|
74
|
+
*/
|
|
75
|
+
header?: React.ReactNode;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Optional footer component
|
|
79
|
+
* Rendered below scrollable content
|
|
80
|
+
*/
|
|
81
|
+
footer?: React.ReactNode;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Override background color
|
|
85
|
+
* If not provided, uses theme's backgroundPrimary
|
|
86
|
+
*/
|
|
87
|
+
backgroundColor?: string;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Custom container style
|
|
91
|
+
*/
|
|
92
|
+
containerStyle?: ViewStyle;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Custom content container style (for ScrollView)
|
|
96
|
+
*/
|
|
97
|
+
contentContainerStyle?: ViewStyle;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Test ID for automation
|
|
101
|
+
*/
|
|
102
|
+
testID?: string;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Hide vertical scroll indicator (default: false)
|
|
106
|
+
*/
|
|
107
|
+
hideScrollIndicator?: boolean;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Enable keyboard avoiding behavior (default: false)
|
|
111
|
+
* Useful for screens with inputs
|
|
112
|
+
*/
|
|
113
|
+
keyboardAvoiding?: boolean;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export const ScreenLayout: React.FC<ScreenLayoutProps> = ({
|
|
117
|
+
children,
|
|
118
|
+
scrollable = true,
|
|
119
|
+
edges = ['top'],
|
|
120
|
+
loading = false,
|
|
121
|
+
loadingIcon = 'settings',
|
|
122
|
+
loadingMessage = 'Loading...',
|
|
123
|
+
header,
|
|
124
|
+
footer,
|
|
125
|
+
backgroundColor,
|
|
126
|
+
containerStyle,
|
|
127
|
+
contentContainerStyle,
|
|
128
|
+
testID,
|
|
129
|
+
hideScrollIndicator = false,
|
|
130
|
+
keyboardAvoiding = false,
|
|
131
|
+
}) => {
|
|
132
|
+
const tokens = useAppDesignTokens();
|
|
133
|
+
const styles = useMemo(() => getStyles(tokens), [tokens]);
|
|
134
|
+
|
|
135
|
+
const bgColor = backgroundColor || tokens.colors.backgroundPrimary;
|
|
136
|
+
|
|
137
|
+
// Show loading state
|
|
138
|
+
if (loading) {
|
|
139
|
+
return (
|
|
140
|
+
<SafeAreaView
|
|
141
|
+
style={[styles.container, { backgroundColor: bgColor }, containerStyle]}
|
|
142
|
+
edges={edges}
|
|
143
|
+
testID={testID}
|
|
144
|
+
>
|
|
145
|
+
<LoadingState
|
|
146
|
+
icon={loadingIcon}
|
|
147
|
+
message={loadingMessage}
|
|
148
|
+
size="large"
|
|
149
|
+
fullScreen
|
|
150
|
+
/>
|
|
151
|
+
</SafeAreaView>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Non-scrollable layout
|
|
156
|
+
if (!scrollable) {
|
|
157
|
+
return (
|
|
158
|
+
<SafeAreaView
|
|
159
|
+
style={[styles.container, { backgroundColor: bgColor }, containerStyle]}
|
|
160
|
+
edges={edges}
|
|
161
|
+
testID={testID}
|
|
162
|
+
>
|
|
163
|
+
{header}
|
|
164
|
+
<View style={[styles.content, contentContainerStyle]}>
|
|
165
|
+
{children}
|
|
166
|
+
</View>
|
|
167
|
+
{footer}
|
|
168
|
+
</SafeAreaView>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Scrollable layout (default)
|
|
173
|
+
return (
|
|
174
|
+
<SafeAreaView
|
|
175
|
+
style={[styles.container, { backgroundColor: bgColor }, containerStyle]}
|
|
176
|
+
edges={edges}
|
|
177
|
+
testID={testID}
|
|
178
|
+
>
|
|
179
|
+
{header}
|
|
180
|
+
<ScrollView
|
|
181
|
+
style={styles.scrollView}
|
|
182
|
+
contentContainerStyle={[styles.scrollContent, contentContainerStyle]}
|
|
183
|
+
showsVerticalScrollIndicator={!hideScrollIndicator}
|
|
184
|
+
keyboardShouldPersistTaps={keyboardAvoiding ? 'handled' : 'never'}
|
|
185
|
+
>
|
|
186
|
+
{children}
|
|
187
|
+
</ScrollView>
|
|
188
|
+
{footer}
|
|
189
|
+
</SafeAreaView>
|
|
190
|
+
);
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const getStyles = (tokens: ReturnType<typeof useAppDesignTokens>) =>
|
|
194
|
+
StyleSheet.create({
|
|
195
|
+
container: {
|
|
196
|
+
flex: 1,
|
|
197
|
+
},
|
|
198
|
+
content: {
|
|
199
|
+
flex: 1,
|
|
200
|
+
},
|
|
201
|
+
scrollView: {
|
|
202
|
+
flex: 1,
|
|
203
|
+
},
|
|
204
|
+
scrollContent: {
|
|
205
|
+
flexGrow: 1,
|
|
206
|
+
paddingHorizontal: tokens.spacing.md,
|
|
207
|
+
paddingBottom: tokens.spacing.lg,
|
|
208
|
+
},
|
|
209
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
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;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DESIGN TOKENS - PUBLIC API
|
|
3
|
+
*
|
|
4
|
+
* ✅ CLEAN BARREL EXPORT - Single source of truth
|
|
5
|
+
* ✅ ZERO DUPLICATION - All tokens from TokenFactory
|
|
6
|
+
* ✅ TYPE-SAFE - Full TypeScript support
|
|
7
|
+
* ✅ FACTORY-FIRST - Benefits all 100+ generated apps
|
|
8
|
+
*
|
|
9
|
+
* @module AppDesignTokens
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// =============================================================================
|
|
13
|
+
// CORE EXPORTS (from TokenFactory)
|
|
14
|
+
// =============================================================================
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
createDesignTokens,
|
|
18
|
+
STATIC_DESIGN_TOKENS,
|
|
19
|
+
STATIC_TOKENS,
|
|
20
|
+
withAlpha,
|
|
21
|
+
type DesignTokens,
|
|
22
|
+
type ThemeMode,
|
|
23
|
+
type ColorPalette,
|
|
24
|
+
} from './core/TokenFactory';
|
|
25
|
+
|
|
26
|
+
// =============================================================================
|
|
27
|
+
// BASE TOKEN EXPORTS
|
|
28
|
+
// =============================================================================
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
BASE_TOKENS,
|
|
32
|
+
spacing,
|
|
33
|
+
typography,
|
|
34
|
+
animations,
|
|
35
|
+
borders,
|
|
36
|
+
iconSizes,
|
|
37
|
+
opacity,
|
|
38
|
+
avatarSizes,
|
|
39
|
+
type Spacing,
|
|
40
|
+
type Typography,
|
|
41
|
+
type Animations,
|
|
42
|
+
type Borders,
|
|
43
|
+
type IconSizes,
|
|
44
|
+
type Opacity,
|
|
45
|
+
type AvatarSizes,
|
|
46
|
+
type BaseTokens,
|
|
47
|
+
} from './core/BaseTokens';
|
|
48
|
+
|
|
49
|
+
// =============================================================================
|
|
50
|
+
// COLOR PALETTE EXPORTS
|
|
51
|
+
// =============================================================================
|
|
52
|
+
|
|
53
|
+
export {
|
|
54
|
+
lightColors,
|
|
55
|
+
darkColors,
|
|
56
|
+
getColorPalette,
|
|
57
|
+
} from './core/ColorPalette';
|