@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.
- package/README.md +2 -2
- package/package.json +7 -5
- package/src/index.ts +29 -221
- package/src/presentation/organisms/AppHeader.tsx +3 -5
- package/src/presentation/tokens/commonStyles.ts +1 -1
- package/src/presentation/atoms/AtomicAvatar.tsx +0 -157
- package/src/presentation/atoms/AtomicAvatarGroup.tsx +0 -169
- package/src/presentation/atoms/AtomicBadge.tsx +0 -232
- package/src/presentation/atoms/AtomicButton.tsx +0 -236
- package/src/presentation/atoms/AtomicCard.tsx +0 -107
- package/src/presentation/atoms/AtomicChip.tsx +0 -223
- package/src/presentation/atoms/AtomicDatePicker.tsx +0 -347
- package/src/presentation/atoms/AtomicDivider.tsx +0 -114
- package/src/presentation/atoms/AtomicFab.tsx +0 -98
- package/src/presentation/atoms/AtomicFilter.tsx +0 -154
- package/src/presentation/atoms/AtomicFormError.tsx +0 -105
- package/src/presentation/atoms/AtomicIcon.tsx +0 -40
- package/src/presentation/atoms/AtomicImage.tsx +0 -149
- package/src/presentation/atoms/AtomicInput.tsx +0 -363
- package/src/presentation/atoms/AtomicNumberInput.tsx +0 -182
- package/src/presentation/atoms/AtomicPicker.tsx +0 -458
- package/src/presentation/atoms/AtomicProgress.tsx +0 -139
- package/src/presentation/atoms/AtomicSearchBar.tsx +0 -114
- package/src/presentation/atoms/AtomicSort.tsx +0 -145
- package/src/presentation/atoms/AtomicSwitch.tsx +0 -166
- package/src/presentation/atoms/AtomicText.tsx +0 -55
- package/src/presentation/atoms/AtomicTextArea.tsx +0 -313
- package/src/presentation/atoms/AtomicTouchable.tsx +0 -209
- package/src/presentation/atoms/fab/styles/fabStyles.ts +0 -69
- package/src/presentation/atoms/fab/types/index.ts +0 -82
- package/src/presentation/atoms/filter/styles/filterStyles.ts +0 -32
- package/src/presentation/atoms/filter/types/index.ts +0 -89
- package/src/presentation/atoms/index.ts +0 -366
- package/src/presentation/atoms/input/hooks/useInputState.ts +0 -15
- package/src/presentation/atoms/input/styles/inputStyles.ts +0 -66
- package/src/presentation/atoms/input/types/index.ts +0 -25
- package/src/presentation/atoms/picker/styles/pickerStyles.ts +0 -207
- package/src/presentation/atoms/picker/types/index.ts +0 -40
- package/src/presentation/atoms/touchable/styles/touchableStyles.ts +0 -62
- package/src/presentation/atoms/touchable/types/index.ts +0 -155
- package/src/presentation/hooks/useResponsive.ts +0 -180
- package/src/presentation/molecules/AtomicConfirmationModal.tsx +0 -243
- package/src/presentation/molecules/EmptyState.tsx +0 -130
- package/src/presentation/molecules/FormField.tsx +0 -128
- package/src/presentation/molecules/GridContainer.tsx +0 -124
- package/src/presentation/molecules/IconContainer.tsx +0 -94
- package/src/presentation/molecules/ListItem.tsx +0 -36
- package/src/presentation/molecules/ScreenHeader.tsx +0 -140
- package/src/presentation/molecules/SearchBar.tsx +0 -85
- package/src/presentation/molecules/SectionCard.tsx +0 -74
- package/src/presentation/molecules/SectionContainer.tsx +0 -106
- package/src/presentation/molecules/SectionHeader.tsx +0 -125
- package/src/presentation/molecules/confirmation-modal/styles/confirmationModalStyles.ts +0 -133
- package/src/presentation/molecules/confirmation-modal/types/index.ts +0 -105
- package/src/presentation/molecules/index.ts +0 -41
- package/src/presentation/molecules/listitem/styles/listItemStyles.ts +0 -19
- package/src/presentation/molecules/listitem/types/index.ts +0 -17
- package/src/presentation/organisms/FormContainer.tsx +0 -180
- package/src/presentation/organisms/ScreenLayout.tsx +0 -171
- package/src/presentation/organisms/index.ts +0 -25
- package/src/presentation/utils/platformConstants.ts +0 -124
- package/src/presentation/utils/responsive.ts +0 -516
package/README.md
CHANGED
|
@@ -133,10 +133,10 @@ responsive.horizontalPadding
|
|
|
133
133
|
|
|
134
134
|
## 🌓 Theme Integration
|
|
135
135
|
|
|
136
|
-
This package works seamlessly with `@umituz/react-native-theme`:
|
|
136
|
+
This package works seamlessly with `@umituz/react-native-design-system-theme`:
|
|
137
137
|
|
|
138
138
|
```typescript
|
|
139
|
-
import { ThemeProvider } from '@umituz/react-native-theme';
|
|
139
|
+
import { ThemeProvider } from '@umituz/react-native-design-system-theme';
|
|
140
140
|
import { ScreenLayout } from '@umituz/react-native-design-system';
|
|
141
141
|
|
|
142
142
|
const App = () => (
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.38",
|
|
4
4
|
"description": "Universal design system for React Native apps - Domain-Driven Design architecture with Material Design 3 components",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"@react-native-community/datetimepicker": "^8.5.0",
|
|
42
42
|
"@react-navigation/native": "^6.0.0",
|
|
43
43
|
"@umituz/react-native-bottom-sheet": "*",
|
|
44
|
-
"@umituz/react-native-icon": "*",
|
|
45
44
|
"expo-linear-gradient": "^15.0.7",
|
|
46
45
|
"lucide-react-native": ">=0.468.0",
|
|
47
46
|
"react": ">=18.2.0 || ^19.0.0",
|
|
@@ -73,7 +72,6 @@
|
|
|
73
72
|
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
74
73
|
"@typescript-eslint/parser": "^7.0.0",
|
|
75
74
|
"@umituz/react-native-bottom-sheet": "*",
|
|
76
|
-
"@umituz/react-native-icon": "^1.0.1",
|
|
77
75
|
"eslint": "^9.0.0",
|
|
78
76
|
"eslint-plugin-react": "^7.33.0",
|
|
79
77
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
@@ -99,7 +97,11 @@
|
|
|
99
97
|
],
|
|
100
98
|
"dependencies": {
|
|
101
99
|
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
102
|
-
"@umituz/react-native-
|
|
103
|
-
"@umituz/react-native-
|
|
100
|
+
"@umituz/react-native-design-system-atoms": "latest",
|
|
101
|
+
"@umituz/react-native-design-system-molecules": "latest",
|
|
102
|
+
"@umituz/react-native-design-system-organisms": "latest",
|
|
103
|
+
"@umituz/react-native-design-system-responsive": "latest",
|
|
104
|
+
"@umituz/react-native-design-system-theme": "latest",
|
|
105
|
+
"@umituz/react-native-design-system-typography": "latest"
|
|
104
106
|
}
|
|
105
107
|
}
|
package/src/index.ts
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* ALL imports from the design system MUST go through this file.
|
|
9
9
|
*
|
|
10
10
|
* Architecture:
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
13
|
-
* -
|
|
11
|
+
* - @umituz/react-native-design-system-atoms: Primitive UI components (AtomicButton, AtomicText, etc.)
|
|
12
|
+
* - @umituz/react-native-design-system-molecules: Composite components (SearchBar, ListItem, etc.)
|
|
13
|
+
* - @umituz/react-native-design-system-organisms: Complex patterns (ScreenLayout, AppHeader, FormContainer)
|
|
14
14
|
* - presentation/tokens: Design tokens (colors, typography, spacing, etc.)
|
|
15
15
|
* - presentation/utils: Utility functions and helpers
|
|
16
16
|
*
|
|
@@ -20,221 +20,38 @@
|
|
|
20
20
|
|
|
21
21
|
// =============================================================================
|
|
22
22
|
// ATOMS - Primitive UI Components
|
|
23
|
+
// Re-exported from @umituz/react-native-design-system-atoms
|
|
23
24
|
// =============================================================================
|
|
24
25
|
|
|
25
|
-
export
|
|
26
|
-
AtomicButton,
|
|
27
|
-
type AtomicButtonProps,
|
|
28
|
-
type ButtonVariant,
|
|
29
|
-
type ButtonSize,
|
|
30
|
-
} from './presentation/atoms/AtomicButton';
|
|
31
|
-
|
|
32
|
-
export {
|
|
33
|
-
AtomicText,
|
|
34
|
-
type AtomicTextProps,
|
|
35
|
-
} from './presentation/atoms/AtomicText';
|
|
26
|
+
export * from '@umituz/react-native-design-system-atoms';
|
|
36
27
|
|
|
37
|
-
// Re-export typography types for convenience (from @umituz/react-native-typography)
|
|
28
|
+
// Re-export typography types for convenience (from @umituz/react-native-design-system-typography)
|
|
38
29
|
export type {
|
|
39
30
|
TextStyleVariant,
|
|
40
31
|
ColorVariant,
|
|
41
|
-
} from '@umituz/react-native-typography';
|
|
42
|
-
|
|
43
|
-
export {
|
|
44
|
-
AtomicCard,
|
|
45
|
-
type AtomicCardProps,
|
|
46
|
-
type AtomicCardVariant,
|
|
47
|
-
type AtomicCardPadding,
|
|
48
|
-
} from './presentation/atoms/AtomicCard';
|
|
49
|
-
|
|
50
|
-
export {
|
|
51
|
-
AtomicInput,
|
|
52
|
-
type AtomicInputProps,
|
|
53
|
-
type AtomicInputVariant,
|
|
54
|
-
type AtomicInputState,
|
|
55
|
-
type AtomicInputSize,
|
|
56
|
-
} from './presentation/atoms/AtomicInput';
|
|
57
|
-
|
|
58
|
-
export {
|
|
59
|
-
AtomicNumberInput,
|
|
60
|
-
type AtomicNumberInputProps,
|
|
61
|
-
} from './presentation/atoms/AtomicNumberInput';
|
|
62
|
-
|
|
63
|
-
export {
|
|
64
|
-
AtomicSwitch,
|
|
65
|
-
type AtomicSwitchProps,
|
|
66
|
-
} from './presentation/atoms/AtomicSwitch';
|
|
67
|
-
|
|
68
|
-
export {
|
|
69
|
-
AtomicIcon,
|
|
70
|
-
type AtomicIconProps,
|
|
71
|
-
type AtomicIconSize,
|
|
72
|
-
type AtomicIconColor,
|
|
73
|
-
type AtomicIconName,
|
|
74
|
-
} from './presentation/atoms/AtomicIcon';
|
|
75
|
-
|
|
76
|
-
export {
|
|
77
|
-
AtomicFormError,
|
|
78
|
-
type AtomicFormErrorProps,
|
|
79
|
-
} from './presentation/atoms/AtomicFormError';
|
|
80
|
-
|
|
81
|
-
export {
|
|
82
|
-
AtomicDatePicker,
|
|
83
|
-
type AtomicDatePickerProps,
|
|
84
|
-
} from './presentation/atoms/AtomicDatePicker';
|
|
85
|
-
|
|
86
|
-
export {
|
|
87
|
-
AtomicPicker,
|
|
88
|
-
type AtomicPickerProps,
|
|
89
|
-
type PickerOption,
|
|
90
|
-
type PickerSize,
|
|
91
|
-
} from './presentation/atoms/AtomicPicker';
|
|
92
|
-
|
|
93
|
-
export {
|
|
94
|
-
AtomicTextArea,
|
|
95
|
-
type AtomicTextAreaProps,
|
|
96
|
-
} from './presentation/atoms/AtomicTextArea';
|
|
97
|
-
|
|
98
|
-
export {
|
|
99
|
-
AtomicBadge,
|
|
100
|
-
type AtomicBadgeProps,
|
|
101
|
-
} from './presentation/atoms/AtomicBadge';
|
|
102
|
-
|
|
103
|
-
export {
|
|
104
|
-
AtomicProgress,
|
|
105
|
-
type AtomicProgressProps,
|
|
106
|
-
} from './presentation/atoms/AtomicProgress';
|
|
107
|
-
|
|
108
|
-
export {
|
|
109
|
-
AtomicDivider,
|
|
110
|
-
type AtomicDividerProps,
|
|
111
|
-
} from './presentation/atoms/AtomicDivider';
|
|
112
|
-
|
|
113
|
-
export {
|
|
114
|
-
AtomicFab,
|
|
115
|
-
type AtomicFabProps,
|
|
116
|
-
type FabSize,
|
|
117
|
-
type FabVariant,
|
|
118
|
-
getFabVariants,
|
|
119
|
-
} from './presentation/atoms/AtomicFab';
|
|
120
|
-
|
|
121
|
-
export {
|
|
122
|
-
AtomicFilter,
|
|
123
|
-
type AtomicFilterProps,
|
|
124
|
-
type FilterOption,
|
|
125
|
-
getFilterContainerStyle,
|
|
126
|
-
getClearAllContainerStyle,
|
|
127
|
-
getScrollContentContainerStyle,
|
|
128
|
-
} from './presentation/atoms/AtomicFilter';
|
|
129
|
-
|
|
130
|
-
export {
|
|
131
|
-
AtomicTouchable,
|
|
132
|
-
type AtomicTouchableProps,
|
|
133
|
-
type TouchableFeedback,
|
|
134
|
-
type FeedbackStrength,
|
|
135
|
-
type HitSlop,
|
|
136
|
-
TouchablePresets,
|
|
137
|
-
getOpacityValue,
|
|
138
|
-
normalizeHitSlop,
|
|
139
|
-
} from './presentation/atoms/AtomicTouchable';
|
|
140
|
-
|
|
141
|
-
export {
|
|
142
|
-
AtomicSearchBar,
|
|
143
|
-
type AtomicSearchBarProps,
|
|
144
|
-
} from './presentation/atoms/AtomicSearchBar';
|
|
145
|
-
|
|
146
|
-
export {
|
|
147
|
-
AtomicSort,
|
|
148
|
-
type AtomicSortProps,
|
|
149
|
-
type SortOption,
|
|
150
|
-
type SortDirection,
|
|
151
|
-
} from './presentation/atoms/AtomicSort';
|
|
32
|
+
} from '@umituz/react-native-design-system-typography';
|
|
152
33
|
|
|
153
34
|
// =============================================================================
|
|
154
35
|
// MOLECULES - Composite Components
|
|
36
|
+
// Re-exported from @umituz/react-native-design-system-molecules
|
|
155
37
|
// =============================================================================
|
|
156
38
|
|
|
157
|
-
export
|
|
158
|
-
FormField,
|
|
159
|
-
type FormFieldProps,
|
|
160
|
-
} from './presentation/molecules/FormField';
|
|
161
|
-
|
|
162
|
-
export {
|
|
163
|
-
ListItem,
|
|
164
|
-
type ListItemProps,
|
|
165
|
-
} from './presentation/molecules/ListItem';
|
|
166
|
-
|
|
167
|
-
export {
|
|
168
|
-
SearchBar,
|
|
169
|
-
type SearchBarProps,
|
|
170
|
-
} from './presentation/molecules/SearchBar';
|
|
171
|
-
|
|
172
|
-
// SettingItem moved to @domains/settings/presentation/components/SettingItem
|
|
173
|
-
// LanguageSwitcher moved to @umituz/react-native-localization
|
|
174
|
-
// Import directly: import { SettingItem } from '@domains/settings/presentation/components/SettingItem';
|
|
175
|
-
|
|
176
|
-
export {
|
|
177
|
-
SectionCard,
|
|
178
|
-
} from './presentation/molecules/SectionCard';
|
|
179
|
-
|
|
180
|
-
export {
|
|
181
|
-
IconContainer,
|
|
182
|
-
} from './presentation/molecules/IconContainer';
|
|
183
|
-
|
|
184
|
-
export {
|
|
185
|
-
SectionHeader,
|
|
186
|
-
} from './presentation/molecules/SectionHeader';
|
|
187
|
-
|
|
188
|
-
export {
|
|
189
|
-
EmptyState,
|
|
190
|
-
} from './presentation/molecules/EmptyState';
|
|
191
|
-
|
|
192
|
-
export {
|
|
193
|
-
GridContainer,
|
|
194
|
-
} from './presentation/molecules/GridContainer';
|
|
195
|
-
|
|
196
|
-
export {
|
|
197
|
-
SectionContainer,
|
|
198
|
-
} from './presentation/molecules/SectionContainer';
|
|
199
|
-
|
|
200
|
-
export {
|
|
201
|
-
ScreenHeader,
|
|
202
|
-
type ScreenHeaderProps,
|
|
203
|
-
} from './presentation/molecules/ScreenHeader';
|
|
204
|
-
|
|
205
|
-
export {
|
|
206
|
-
AtomicConfirmationModal,
|
|
207
|
-
useConfirmationModal,
|
|
208
|
-
type AtomicConfirmationModalProps,
|
|
209
|
-
type ConfirmationModalVariant,
|
|
210
|
-
} from './presentation/molecules/AtomicConfirmationModal';
|
|
39
|
+
export * from '@umituz/react-native-design-system-molecules';
|
|
211
40
|
|
|
212
41
|
// =============================================================================
|
|
213
42
|
// ORGANISMS - Complex Patterns
|
|
43
|
+
// Re-exported from @umituz/react-native-design-system-organisms
|
|
214
44
|
// =============================================================================
|
|
215
45
|
|
|
216
|
-
export
|
|
217
|
-
ScreenLayout,
|
|
218
|
-
type ScreenLayoutProps,
|
|
219
|
-
} from './presentation/organisms/ScreenLayout';
|
|
220
|
-
|
|
221
|
-
export {
|
|
222
|
-
AppHeader,
|
|
223
|
-
type AppHeaderProps,
|
|
224
|
-
} from './presentation/organisms/AppHeader';
|
|
225
|
-
|
|
226
|
-
export {
|
|
227
|
-
FormContainer,
|
|
228
|
-
type FormContainerProps,
|
|
229
|
-
} from './presentation/organisms/FormContainer';
|
|
46
|
+
export * from '@umituz/react-native-design-system-organisms';
|
|
230
47
|
|
|
231
48
|
// Note: FeedbackModal moved to @domains/feedback
|
|
232
49
|
// Import from feedback domain: import { FeedbackModal } from '@domains/feedback';
|
|
233
50
|
|
|
234
51
|
// =============================================================================
|
|
235
|
-
// THEME-RELATED EXPORTS - Re-exported from @umituz/react-native-theme
|
|
52
|
+
// THEME-RELATED EXPORTS - Re-exported from @umituz/react-native-design-system-theme
|
|
236
53
|
// =============================================================================
|
|
237
|
-
// All tokens, colors, and theme utilities come from @umituz/react-native-theme
|
|
54
|
+
// All tokens, colors, and theme utilities come from @umituz/react-native-design-system-theme
|
|
238
55
|
// Design system does NOT define any tokens - it only uses them from theme package
|
|
239
56
|
|
|
240
57
|
export {
|
|
@@ -258,17 +75,18 @@ export {
|
|
|
258
75
|
type Spacing,
|
|
259
76
|
type Typography,
|
|
260
77
|
type Borders,
|
|
261
|
-
} from '@umituz/react-native-theme';
|
|
78
|
+
} from '@umituz/react-native-design-system-theme';
|
|
262
79
|
|
|
263
80
|
// Hook for dynamic theme-aware tokens (re-exported from theme package)
|
|
264
|
-
export { useAppDesignTokens } from '@umituz/react-native-theme';
|
|
81
|
+
export { useAppDesignTokens } from '@umituz/react-native-design-system-theme';
|
|
265
82
|
|
|
266
83
|
export {
|
|
267
84
|
useCommonStyles,
|
|
268
85
|
} from './presentation/tokens/commonStyles';
|
|
269
86
|
|
|
270
87
|
// =============================================================================
|
|
271
|
-
// UTILITIES - Helper Functions
|
|
88
|
+
// UTILITIES - Helper Functions & Responsive Utilities
|
|
89
|
+
// Re-exported from @umituz/react-native-design-system-responsive
|
|
272
90
|
// =============================================================================
|
|
273
91
|
|
|
274
92
|
export {
|
|
@@ -277,20 +95,10 @@ export {
|
|
|
277
95
|
PLATFORM_CONSTANTS,
|
|
278
96
|
isValidTouchTarget,
|
|
279
97
|
getMinTouchTarget,
|
|
280
|
-
} from './presentation/utils/platformConstants';
|
|
281
|
-
|
|
282
|
-
// =============================================================================
|
|
283
|
-
// RESPONSIVE UTILITIES - Centralized Responsive Management
|
|
284
|
-
// =============================================================================
|
|
285
|
-
|
|
286
|
-
export {
|
|
287
98
|
useResponsive,
|
|
288
99
|
useResponsiveSizes,
|
|
289
100
|
useDeviceType,
|
|
290
101
|
type UseResponsiveReturn,
|
|
291
|
-
} from './presentation/hooks/useResponsive';
|
|
292
|
-
|
|
293
|
-
export {
|
|
294
102
|
getScreenDimensions,
|
|
295
103
|
isSmallPhone,
|
|
296
104
|
isTablet,
|
|
@@ -316,28 +124,28 @@ export {
|
|
|
316
124
|
getOnboardingTextPadding,
|
|
317
125
|
getOnboardingDescriptionMarginTop,
|
|
318
126
|
DeviceType,
|
|
319
|
-
} from '
|
|
127
|
+
} from '@umituz/react-native-design-system-responsive';
|
|
320
128
|
|
|
321
129
|
// =============================================================================
|
|
322
130
|
// THEME MANAGEMENT - Global Theme Store
|
|
323
131
|
// =============================================================================
|
|
324
132
|
|
|
325
|
-
// Theme management moved to @umituz/react-native-theme
|
|
133
|
+
// Theme management moved to @umituz/react-native-design-system-theme
|
|
326
134
|
export {
|
|
327
135
|
useDesignSystemTheme,
|
|
328
|
-
} from '@umituz/react-native-theme';
|
|
136
|
+
} from '@umituz/react-native-design-system-theme';
|
|
329
137
|
|
|
330
138
|
// =============================================================================
|
|
331
139
|
// ICONS DOMAIN - Universal Icon System
|
|
332
140
|
// =============================================================================
|
|
333
|
-
// Icon components
|
|
334
|
-
// Import directly: import {
|
|
141
|
+
// Icon components are now part of @umituz/react-native-design-system-atoms
|
|
142
|
+
// Import directly: import { AtomicIcon, IconName, IconSize, IconColor } from '@umituz/react-native-design-system-atoms';
|
|
335
143
|
|
|
336
|
-
// Re-export for backward compatibility
|
|
144
|
+
// Re-export for backward compatibility
|
|
337
145
|
export {
|
|
338
|
-
Icon,
|
|
339
|
-
type IconProps,
|
|
340
|
-
type IconSize,
|
|
341
|
-
type IconColor,
|
|
342
|
-
type IconName,
|
|
343
|
-
} from '@umituz/react-native-
|
|
146
|
+
AtomicIcon as Icon,
|
|
147
|
+
type AtomicIconProps as IconProps,
|
|
148
|
+
type AtomicIconSize as IconSize,
|
|
149
|
+
type AtomicIconColor as IconColor,
|
|
150
|
+
type AtomicIconName as IconName,
|
|
151
|
+
} from '@umituz/react-native-design-system-atoms';
|
|
@@ -10,11 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import { View, ViewStyle, SafeAreaView } from 'react-native';
|
|
13
|
-
import { useAppDesignTokens } from '@umituz/react-native-theme';
|
|
14
|
-
import { AtomicText } from '
|
|
15
|
-
import {
|
|
16
|
-
import { AtomicIcon } from '../atoms/AtomicIcon';
|
|
17
|
-
import type { IconName } from '@umituz/react-native-icon';
|
|
13
|
+
import { useAppDesignTokens } from '@umituz/react-native-design-system-theme';
|
|
14
|
+
import { AtomicText, AtomicButton, AtomicIcon } from '@umituz/react-native-design-system-atoms';
|
|
15
|
+
import type { IconName } from '@umituz/react-native-design-system-atoms';
|
|
18
16
|
|
|
19
17
|
// =============================================================================
|
|
20
18
|
// TYPE DEFINITIONS
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import { ViewStyle, TextStyle } from 'react-native';
|
|
19
|
-
import { useAppDesignTokens } from '@umituz/react-native-theme';
|
|
19
|
+
import { useAppDesignTokens } from '@umituz/react-native-design-system-theme';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Hook to get common styles with dynamic theme support
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AtomicAvatar - Universal Avatar Component
|
|
3
|
-
*
|
|
4
|
-
* Displays user profile images with fallback to initials
|
|
5
|
-
* Theme: {{THEME_NAME}} ({{CATEGORY}} category)
|
|
6
|
-
*
|
|
7
|
-
* Atomic Design Level: ATOM
|
|
8
|
-
* Purpose: User profile image display
|
|
9
|
-
*
|
|
10
|
-
* Usage:
|
|
11
|
-
* - User profile pictures
|
|
12
|
-
* - Contact avatars
|
|
13
|
-
* - Group member avatars
|
|
14
|
-
* - Default user placeholders
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import React from 'react';
|
|
18
|
-
import { View, StyleSheet, ViewStyle, ImageStyle } from 'react-native';
|
|
19
|
-
import { AtomicImage } from './AtomicImage';
|
|
20
|
-
import { AtomicText } from './AtomicText';
|
|
21
|
-
import { useAppDesignTokens } from '@umituz/react-native-theme';
|
|
22
|
-
|
|
23
|
-
// =============================================================================
|
|
24
|
-
// TYPE DEFINITIONS
|
|
25
|
-
// =============================================================================
|
|
26
|
-
|
|
27
|
-
export interface AtomicAvatarProps {
|
|
28
|
-
/** Image source (URI or require) */
|
|
29
|
-
source?: { uri: string } | number;
|
|
30
|
-
/** User's name for fallback initials */
|
|
31
|
-
name?: string;
|
|
32
|
-
/** Size of the avatar */
|
|
33
|
-
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
34
|
-
/** Custom size in pixels */
|
|
35
|
-
customSize?: number;
|
|
36
|
-
/** Background color for fallback */
|
|
37
|
-
backgroundColor?: string;
|
|
38
|
-
/** Text color for initials */
|
|
39
|
-
textColor?: string;
|
|
40
|
-
/** Border radius (default: circular) */
|
|
41
|
-
borderRadius?: number;
|
|
42
|
-
/** Border width */
|
|
43
|
-
borderWidth?: number;
|
|
44
|
-
/** Border color */
|
|
45
|
-
borderColor?: string;
|
|
46
|
-
/** Style overrides */
|
|
47
|
-
style?: ViewStyle | ViewStyle[];
|
|
48
|
-
/** Image style overrides */
|
|
49
|
-
imageStyle?: ImageStyle | ImageStyle[];
|
|
50
|
-
/** Test ID for testing */
|
|
51
|
-
testID?: string;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// =============================================================================
|
|
55
|
-
// COMPONENT IMPLEMENTATION
|
|
56
|
-
// =============================================================================
|
|
57
|
-
|
|
58
|
-
export const AtomicAvatar: React.FC<AtomicAvatarProps> = ({
|
|
59
|
-
source,
|
|
60
|
-
name,
|
|
61
|
-
size = 'md',
|
|
62
|
-
customSize,
|
|
63
|
-
backgroundColor,
|
|
64
|
-
textColor,
|
|
65
|
-
borderRadius,
|
|
66
|
-
borderWidth = 0,
|
|
67
|
-
borderColor,
|
|
68
|
-
style,
|
|
69
|
-
imageStyle,
|
|
70
|
-
testID,
|
|
71
|
-
}) => {
|
|
72
|
-
const tokens = useAppDesignTokens();
|
|
73
|
-
|
|
74
|
-
const avatarSize = customSize || tokens.avatarSizes[size];
|
|
75
|
-
const avatarRadius = borderRadius ?? avatarSize / 2;
|
|
76
|
-
|
|
77
|
-
// Generate initials from name
|
|
78
|
-
const getInitials = (name: string): string => {
|
|
79
|
-
return name
|
|
80
|
-
.split(' ')
|
|
81
|
-
.map(word => word.charAt(0))
|
|
82
|
-
.join('')
|
|
83
|
-
.toUpperCase()
|
|
84
|
-
.slice(0, 2);
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
// Default colors
|
|
88
|
-
const defaultBackgroundColor = backgroundColor || tokens.colors.primary;
|
|
89
|
-
const defaultTextColor = textColor || tokens.colors.onPrimary;
|
|
90
|
-
const defaultBorderColor = borderColor || tokens.colors.border;
|
|
91
|
-
|
|
92
|
-
const avatarStyle: ViewStyle = {
|
|
93
|
-
width: avatarSize,
|
|
94
|
-
height: avatarSize,
|
|
95
|
-
borderRadius: avatarRadius,
|
|
96
|
-
backgroundColor: defaultBackgroundColor,
|
|
97
|
-
borderWidth,
|
|
98
|
-
borderColor: defaultBorderColor,
|
|
99
|
-
alignItems: 'center',
|
|
100
|
-
justifyContent: 'center',
|
|
101
|
-
overflow: 'hidden',
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
const imageStyleFinal: ImageStyle = {
|
|
105
|
-
width: avatarSize,
|
|
106
|
-
height: avatarSize,
|
|
107
|
-
borderRadius: avatarRadius,
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
// Font size based on avatar size
|
|
111
|
-
const getFontSize = (size: number): number => {
|
|
112
|
-
if (size <= 32) return 12;
|
|
113
|
-
if (size <= 48) return 16;
|
|
114
|
-
if (size <= 64) return 20;
|
|
115
|
-
return 24;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
return (
|
|
119
|
-
<View style={[avatarStyle, style]} testID={testID}>
|
|
120
|
-
{source ? (
|
|
121
|
-
<AtomicImage
|
|
122
|
-
source={source}
|
|
123
|
-
style={StyleSheet.flatten([imageStyleFinal, imageStyle])}
|
|
124
|
-
resizeMode="cover"
|
|
125
|
-
/>
|
|
126
|
-
) : name ? (
|
|
127
|
-
<AtomicText
|
|
128
|
-
type="labelLarge"
|
|
129
|
-
color={defaultTextColor}
|
|
130
|
-
style={{
|
|
131
|
-
fontSize: getFontSize(avatarSize),
|
|
132
|
-
fontWeight: tokens.typography.semibold,
|
|
133
|
-
}}
|
|
134
|
-
>
|
|
135
|
-
{getInitials(name)}
|
|
136
|
-
</AtomicText>
|
|
137
|
-
) : (
|
|
138
|
-
<AtomicText
|
|
139
|
-
type="labelLarge"
|
|
140
|
-
color={defaultTextColor}
|
|
141
|
-
style={{
|
|
142
|
-
fontSize: getFontSize(avatarSize),
|
|
143
|
-
fontWeight: tokens.typography.semibold,
|
|
144
|
-
}}
|
|
145
|
-
>
|
|
146
|
-
?
|
|
147
|
-
</AtomicText>
|
|
148
|
-
)}
|
|
149
|
-
</View>
|
|
150
|
-
);
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
// =============================================================================
|
|
154
|
-
// EXPORTS
|
|
155
|
-
// =============================================================================
|
|
156
|
-
|
|
157
|
-
export default AtomicAvatar;
|