@umituz/react-native-design-system 2.3.14 → 2.3.16
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/package.json +19 -2
- package/src/index.ts +105 -0
- package/src/layouts/ScreenLayout/ScreenLayout.example.tsx +2 -2
- package/src/layouts/ScreenLayout/ScreenLayout.tsx +1 -1
- package/src/molecules/animation/core/AnimationCore.ts +29 -0
- package/src/molecules/animation/domain/entities/Animation.ts +81 -0
- package/src/molecules/animation/domain/entities/Fireworks.ts +44 -0
- package/src/molecules/animation/domain/entities/Theme.ts +76 -0
- package/src/molecules/animation/index.ts +146 -0
- package/src/molecules/animation/infrastructure/services/AnimationConfigService.ts +35 -0
- package/src/molecules/animation/infrastructure/services/SpringAnimationConfigService.ts +67 -0
- package/src/molecules/animation/infrastructure/services/TimingAnimationConfigService.ts +57 -0
- package/src/molecules/animation/infrastructure/services/__tests__/SpringAnimationConfigService.test.ts +114 -0
- package/src/molecules/animation/infrastructure/services/__tests__/TimingAnimationConfigService.test.ts +105 -0
- package/src/molecules/animation/presentation/components/Fireworks.tsx +126 -0
- package/src/molecules/animation/presentation/components/__tests__/Fireworks.test.tsx +189 -0
- package/src/molecules/animation/presentation/hooks/__tests__/useAnimation.integration.test.ts +216 -0
- package/src/molecules/animation/presentation/hooks/__tests__/useFireworks.test.ts +242 -0
- package/src/molecules/animation/presentation/hooks/__tests__/useGesture.test.ts +111 -0
- package/src/molecules/animation/presentation/hooks/__tests__/useSpringAnimation.test.ts +131 -0
- package/src/molecules/animation/presentation/hooks/__tests__/useTimingAnimation.test.ts +175 -0
- package/src/molecules/animation/presentation/hooks/__tests__/useTransformAnimation.test.ts +137 -0
- package/src/molecules/animation/presentation/hooks/useAnimation.ts +77 -0
- package/src/molecules/animation/presentation/hooks/useFireworks.ts +141 -0
- package/src/molecules/animation/presentation/hooks/useGesture.ts +61 -0
- package/src/molecules/animation/presentation/hooks/useGestureCreators.ts +163 -0
- package/src/molecules/animation/presentation/hooks/useGestureState.ts +53 -0
- package/src/molecules/animation/presentation/hooks/useIconAnimations.ts +119 -0
- package/src/molecules/animation/presentation/hooks/useModalAnimations.ts +124 -0
- package/src/molecules/animation/presentation/hooks/useReanimatedReady.ts +60 -0
- package/src/molecules/animation/presentation/hooks/useSpringAnimation.ts +69 -0
- package/src/molecules/animation/presentation/hooks/useTimingAnimation.ts +111 -0
- package/src/molecules/animation/presentation/hooks/useTransformAnimation.ts +57 -0
- package/src/molecules/animation/presentation/providers/AnimationThemeProvider.tsx +62 -0
- package/src/molecules/animation/presentation/providers/__tests__/AnimationThemeProvider.test.tsx +165 -0
- package/src/molecules/animation/types/global.d.ts +97 -0
- package/src/molecules/celebration/domain/entities/CelebrationConfig.ts +17 -0
- package/src/molecules/celebration/domain/entities/FireworksConfig.ts +32 -0
- package/src/molecules/celebration/index.ts +93 -0
- package/src/molecules/celebration/infrastructure/services/FireworksConfigService.ts +49 -0
- package/src/molecules/celebration/presentation/components/CelebrationFireworksOverlay.tsx +33 -0
- package/src/molecules/celebration/presentation/components/CelebrationModal.tsx +78 -0
- package/src/molecules/celebration/presentation/components/CelebrationModalContent.tsx +90 -0
- package/src/molecules/celebration/presentation/hooks/useCelebrationModalAnimation.ts +49 -0
- package/src/molecules/celebration/presentation/hooks/useCelebrationState.ts +45 -0
- package/src/molecules/celebration/presentation/styles/CelebrationModalStyles.ts +65 -0
- package/src/molecules/countdown/components/Countdown.tsx +128 -0
- package/src/molecules/countdown/components/CountdownHeader.tsx +84 -0
- package/src/molecules/countdown/components/TimeUnit.tsx +73 -0
- package/src/molecules/countdown/hooks/useCountdown.ts +107 -0
- package/src/molecules/countdown/index.ts +25 -0
- package/src/molecules/countdown/types/CountdownTypes.ts +31 -0
- package/src/molecules/countdown/utils/TimeCalculator.ts +46 -0
- package/src/molecules/emoji/domain/entities/Emoji.ts +129 -0
- package/src/molecules/emoji/index.ts +177 -0
- package/src/molecules/emoji/presentation/components/EmojiPicker.tsx +102 -0
- package/src/molecules/emoji/presentation/hooks/useEmojiPicker.ts +171 -0
- package/src/molecules/index.ts +21 -0
- package/src/molecules/long-press-menu/domain/entities/MenuAction.ts +37 -0
- package/src/molecules/long-press-menu/index.ts +16 -0
- package/src/molecules/navigation/StackNavigator.tsx +75 -0
- package/src/molecules/navigation/TabsNavigator.tsx +94 -0
- package/src/molecules/navigation/components/FabButton.tsx +45 -0
- package/src/molecules/navigation/components/TabLabel.tsx +47 -0
- package/src/molecules/navigation/createStackNavigator.ts +20 -0
- package/src/molecules/navigation/createTabNavigator.ts +20 -0
- package/src/molecules/navigation/hooks/useTabBarStyles.ts +54 -0
- package/src/molecules/navigation/index.ts +37 -0
- package/src/molecules/navigation/types.ts +118 -0
- package/src/molecules/navigation/utils/AppNavigation.ts +101 -0
- package/src/molecules/navigation/utils/IconRenderer.ts +50 -0
- package/src/molecules/navigation/utils/LabelProcessor.ts +70 -0
- package/src/molecules/navigation/utils/NavigationCleanup.ts +62 -0
- package/src/molecules/navigation/utils/NavigationTheme.ts +21 -0
- package/src/molecules/navigation/utils/NavigationValidator.ts +61 -0
- package/src/molecules/navigation/utils/ScreenFactory.ts +115 -0
- package/src/molecules/navigation/utils/__tests__/IconRenderer.getIconName.test.ts +109 -0
- package/src/molecules/navigation/utils/__tests__/IconRenderer.renderIcon.test.ts +116 -0
- package/src/molecules/navigation/utils/__tests__/LabelProcessor.processLabel.test.ts +116 -0
- package/src/molecules/navigation/utils/__tests__/LabelProcessor.processTitle.test.ts +59 -0
- package/src/molecules/navigation/utils/__tests__/NavigationCleanup.test.ts +271 -0
- package/src/molecules/navigation/utils/__tests__/NavigationValidator.test.ts +252 -0
- package/src/molecules/swipe-actions/domain/entities/SwipeAction.ts +194 -0
- package/src/molecules/swipe-actions/index.ts +6 -0
- package/src/molecules/swipe-actions/presentation/components/SwipeActionButton.tsx +131 -0
- package/src/theme/hooks/useResponsiveDesignTokens.ts +1 -1
- package/src/utilities/clipboard/ClipboardUtils.ts +71 -0
- package/src/utilities/clipboard/index.ts +5 -0
- package/src/utilities/index.ts +6 -0
- package/src/utilities/sharing/domain/entities/Share.ts +210 -0
- package/src/utilities/sharing/index.ts +205 -0
- package/src/utilities/sharing/infrastructure/services/SharingService.ts +165 -0
- package/src/utilities/sharing/presentation/hooks/useSharing.ts +154 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.16",
|
|
4
4
|
"description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive and safe area utilities",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -53,19 +53,27 @@
|
|
|
53
53
|
"@gorhom/bottom-sheet": ">=5.0.0",
|
|
54
54
|
"@react-native-async-storage/async-storage": ">=2.0.0",
|
|
55
55
|
"@react-native-community/datetimepicker": ">=8.0.0",
|
|
56
|
+
"@react-navigation/bottom-tabs": ">=6.0.0",
|
|
56
57
|
"@react-navigation/native": ">=6.0.0",
|
|
58
|
+
"@react-navigation/stack": ">=6.0.0",
|
|
59
|
+
"@umituz/react-native-haptics": "latest",
|
|
60
|
+
"@umituz/react-native-localization": "latest",
|
|
57
61
|
"@umituz/react-native-uuid": "latest",
|
|
58
62
|
"expo-application": ">=5.0.0",
|
|
59
63
|
"expo-calendar": ">=13.0.0",
|
|
64
|
+
"expo-clipboard": ">=8.0.0",
|
|
60
65
|
"expo-crypto": ">=13.0.0",
|
|
61
66
|
"expo-device": ">=5.0.0",
|
|
62
67
|
"expo-linear-gradient": ">=15.0.0",
|
|
68
|
+
"expo-sharing": ">=12.0.0",
|
|
63
69
|
"react": ">=19.0.0",
|
|
64
70
|
"react-native": ">=0.81.0",
|
|
65
71
|
"react-native-gesture-handler": ">=2.20.0",
|
|
72
|
+
"react-native-haptic-feedback": ">=2.0.0",
|
|
66
73
|
"react-native-reanimated": ">=3.16.0",
|
|
67
74
|
"react-native-safe-area-context": ">=5.0.0",
|
|
68
75
|
"react-native-svg": ">=15.0.0",
|
|
76
|
+
"rn-emoji-keyboard": ">=1.7.0",
|
|
69
77
|
"zustand": ">=5.0.0"
|
|
70
78
|
},
|
|
71
79
|
"peerDependenciesMeta": {
|
|
@@ -91,11 +99,15 @@
|
|
|
91
99
|
"@gorhom/bottom-sheet": "^5.0.0",
|
|
92
100
|
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
93
101
|
"@react-native-community/datetimepicker": "^8.5.1",
|
|
102
|
+
"@react-navigation/bottom-tabs": "^6.6.1",
|
|
94
103
|
"@react-navigation/native": "^6.0.0",
|
|
104
|
+
"@react-navigation/stack": "^6.4.1",
|
|
95
105
|
"@types/jest": "^30.0.0",
|
|
96
106
|
"@types/react": "~19.1.10",
|
|
97
107
|
"@typescript-eslint/eslint-plugin": "^8.50.1",
|
|
98
108
|
"@typescript-eslint/parser": "^8.50.1",
|
|
109
|
+
"@umituz/react-native-haptics": "^1.0.2",
|
|
110
|
+
"@umituz/react-native-localization": "^3.5.34",
|
|
99
111
|
"@umituz/react-native-uuid": "latest",
|
|
100
112
|
"eslint": "^9.39.2",
|
|
101
113
|
"eslint-plugin-react": "^7.37.5",
|
|
@@ -103,15 +115,20 @@
|
|
|
103
115
|
"eslint-plugin-react-native": "^5.0.0",
|
|
104
116
|
"expo-application": "~5.9.1",
|
|
105
117
|
"expo-calendar": "~14.0.0",
|
|
118
|
+
"expo-clipboard": "~8.0.7",
|
|
106
119
|
"expo-crypto": "~14.0.0",
|
|
107
120
|
"expo-device": "~7.0.2",
|
|
121
|
+
"expo-haptics": "~14.0.0",
|
|
108
122
|
"expo-localization": "~16.0.1",
|
|
123
|
+
"expo-sharing": "~14.0.8",
|
|
109
124
|
"react": "19.1.0",
|
|
110
125
|
"react-native": "0.81.5",
|
|
111
126
|
"react-native-gesture-handler": "^2.20.0",
|
|
127
|
+
"react-native-haptic-feedback": "^2.3.3",
|
|
112
128
|
"react-native-reanimated": "^3.16.0",
|
|
113
129
|
"react-native-safe-area-context": "^5.6.0",
|
|
114
130
|
"react-native-svg": "15.12.1",
|
|
131
|
+
"rn-emoji-keyboard": "^1.7.0",
|
|
115
132
|
"typescript": "~5.9.2",
|
|
116
133
|
"zustand": "^5.0.2"
|
|
117
134
|
},
|
|
@@ -123,4 +140,4 @@
|
|
|
123
140
|
"README.md",
|
|
124
141
|
"LICENSE"
|
|
125
142
|
]
|
|
126
|
-
}
|
|
143
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -326,6 +326,105 @@ export {
|
|
|
326
326
|
type CalendarWeek,
|
|
327
327
|
type ICalendarRepository,
|
|
328
328
|
type CalendarViewMode,
|
|
329
|
+
// Swipe Actions
|
|
330
|
+
SwipeActionButton,
|
|
331
|
+
SwipeActionUtils,
|
|
332
|
+
ACTION_PRESETS,
|
|
333
|
+
DEFAULT_SWIPE_CONFIG,
|
|
334
|
+
type SwipeActionButtonProps,
|
|
335
|
+
type SwipeActionType,
|
|
336
|
+
type SwipeActionConfig,
|
|
337
|
+
type SwipeDirection,
|
|
338
|
+
type SwipeableConfig,
|
|
339
|
+
// Navigation
|
|
340
|
+
TabsNavigator,
|
|
341
|
+
StackNavigator,
|
|
342
|
+
createTabNavigator,
|
|
343
|
+
createStackNavigator,
|
|
344
|
+
FabButton,
|
|
345
|
+
NavigationCleanupManager,
|
|
346
|
+
type TabsNavigatorProps,
|
|
347
|
+
type StackNavigatorProps,
|
|
348
|
+
type FabButtonProps,
|
|
349
|
+
type TabScreen,
|
|
350
|
+
type TabNavigatorConfig,
|
|
351
|
+
type StackScreen,
|
|
352
|
+
type StackNavigatorConfig,
|
|
353
|
+
type BaseScreen,
|
|
354
|
+
type BaseNavigatorConfig,
|
|
355
|
+
type IconRendererProps,
|
|
356
|
+
type LabelProcessorProps,
|
|
357
|
+
type FabConfig,
|
|
358
|
+
type NavigationCleanup,
|
|
359
|
+
type BottomTabNavigationOptions,
|
|
360
|
+
type BottomTabScreenProps,
|
|
361
|
+
type StackNavigationOptions,
|
|
362
|
+
// Celebration
|
|
363
|
+
CelebrationModal,
|
|
364
|
+
CelebrationModalContent,
|
|
365
|
+
CelebrationFireworksOverlay,
|
|
366
|
+
useCelebrationState,
|
|
367
|
+
useCelebrationModalAnimation,
|
|
368
|
+
FireworksConfigService,
|
|
369
|
+
DEFAULT_FIREWORKS_COLORS,
|
|
370
|
+
DEFAULT_FIREWORKS_CONFIG,
|
|
371
|
+
type CelebrationConfig,
|
|
372
|
+
type CelebrationAction,
|
|
373
|
+
type ThemeColors,
|
|
374
|
+
type CelebrationFireworksConfig,
|
|
375
|
+
type UseCelebrationStateReturn,
|
|
376
|
+
type UseCelebrationModalAnimationReturn,
|
|
377
|
+
type CelebrationModalProps,
|
|
378
|
+
type CelebrationModalContentProps,
|
|
379
|
+
type CelebrationFireworksOverlayProps,
|
|
380
|
+
// Long Press Menu
|
|
381
|
+
type MenuAction,
|
|
382
|
+
type MenuActionTypeValue,
|
|
383
|
+
MenuActionType,
|
|
384
|
+
// Emoji
|
|
385
|
+
EmojiPicker,
|
|
386
|
+
useEmojiPicker,
|
|
387
|
+
EmojiCategory,
|
|
388
|
+
EmojiUtils,
|
|
389
|
+
type EmojiObject,
|
|
390
|
+
type EmojiPickerConfig,
|
|
391
|
+
type EmojiSelectCallback,
|
|
392
|
+
type EmojiPickerState,
|
|
393
|
+
type EmojiPickerProps,
|
|
394
|
+
type UseEmojiPickerOptions,
|
|
395
|
+
type UseEmojiPickerReturn,
|
|
396
|
+
// Countdown
|
|
397
|
+
Countdown,
|
|
398
|
+
TimeUnit,
|
|
399
|
+
CountdownHeader,
|
|
400
|
+
useCountdown,
|
|
401
|
+
calculateTimeRemaining,
|
|
402
|
+
padNumber,
|
|
403
|
+
getNextDayStart,
|
|
404
|
+
getNextYearStart,
|
|
405
|
+
type CountdownProps,
|
|
406
|
+
type TimeUnitProps,
|
|
407
|
+
type CountdownHeaderProps,
|
|
408
|
+
type UseCountdownOptions,
|
|
409
|
+
type UseCountdownReturn,
|
|
410
|
+
type TimeRemaining,
|
|
411
|
+
type CountdownTarget,
|
|
412
|
+
type CountdownFormatOptions,
|
|
413
|
+
type CountdownDisplayConfig,
|
|
414
|
+
// Animation
|
|
415
|
+
Animated,
|
|
416
|
+
useSharedValue,
|
|
417
|
+
useAnimatedStyle,
|
|
418
|
+
withTiming,
|
|
419
|
+
withSpring,
|
|
420
|
+
withSequence,
|
|
421
|
+
withRepeat,
|
|
422
|
+
runOnJS,
|
|
423
|
+
cancelAnimation,
|
|
424
|
+
Easing,
|
|
425
|
+
type SharedValue,
|
|
426
|
+
type WithTimingConfig,
|
|
427
|
+
type WithSpringConfig,
|
|
329
428
|
} from './molecules';
|
|
330
429
|
|
|
331
430
|
// =============================================================================
|
|
@@ -364,3 +463,9 @@ export {
|
|
|
364
463
|
responsiveStyle,
|
|
365
464
|
combineStyles,
|
|
366
465
|
} from './presentation/utils/variants/helpers';
|
|
466
|
+
|
|
467
|
+
// =============================================================================
|
|
468
|
+
// UTILITIES
|
|
469
|
+
// =============================================================================
|
|
470
|
+
|
|
471
|
+
export * from './utilities';
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
ScreenHeader,
|
|
13
13
|
AtomicButton,
|
|
14
14
|
AtomicText
|
|
15
|
-
} from '
|
|
15
|
+
} from '../../index';
|
|
16
16
|
|
|
17
17
|
// 1. Wrap your app root with SafeAreaProvider
|
|
18
18
|
export function App() {
|
|
@@ -78,7 +78,7 @@ export function CustomScrollScreen() {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
// 5. Using safe area hooks directly
|
|
81
|
-
import { useContentSafeAreaPadding, useSafeAreaInsets } from '
|
|
81
|
+
import { useContentSafeAreaPadding, useSafeAreaInsets } from '../../index';
|
|
82
82
|
|
|
83
83
|
export function CustomComponent() {
|
|
84
84
|
const insets = useSafeAreaInsets();
|
|
@@ -35,7 +35,7 @@ import { getResponsiveHorizontalPadding } from '../../responsive/responsiveLayou
|
|
|
35
35
|
* NOTE: This component now works in conjunction with the SafeAreaProvider
|
|
36
36
|
* from our safe-area module. The SafeAreaProvider should wrap your app root:
|
|
37
37
|
*
|
|
38
|
-
* import { SafeAreaProvider } from '
|
|
38
|
+
* import { SafeAreaProvider } from '../../index';
|
|
39
39
|
*
|
|
40
40
|
* function App() {
|
|
41
41
|
* return (
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Animation Core Exports
|
|
3
|
+
*
|
|
4
|
+
* Re-exports react-native-reanimated for centralized usage.
|
|
5
|
+
* All packages should use this instead of importing directly.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
useSharedValue,
|
|
10
|
+
useAnimatedStyle,
|
|
11
|
+
withTiming,
|
|
12
|
+
withSpring,
|
|
13
|
+
withSequence,
|
|
14
|
+
withRepeat,
|
|
15
|
+
runOnJS,
|
|
16
|
+
cancelAnimation,
|
|
17
|
+
Easing,
|
|
18
|
+
} from 'react-native-reanimated';
|
|
19
|
+
|
|
20
|
+
// Re-export Animated namespace
|
|
21
|
+
import Animated from 'react-native-reanimated';
|
|
22
|
+
export { Animated };
|
|
23
|
+
|
|
24
|
+
// Re-export types
|
|
25
|
+
export type {
|
|
26
|
+
SharedValue,
|
|
27
|
+
WithTimingConfig,
|
|
28
|
+
WithSpringConfig,
|
|
29
|
+
} from 'react-native-reanimated';
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Animation Domain Entity
|
|
3
|
+
*
|
|
4
|
+
* Core animation types and configurations for React Native.
|
|
5
|
+
* Wraps react-native-reanimated and react-native-gesture-handler.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { WithSpringConfig, WithTimingConfig } from 'react-native-reanimated';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Animation timing configuration
|
|
12
|
+
*/
|
|
13
|
+
export type AnimationTimingConfig = WithTimingConfig & {
|
|
14
|
+
duration?: number;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Animation spring configuration
|
|
19
|
+
*/
|
|
20
|
+
export type AnimationSpringConfig = WithSpringConfig & {
|
|
21
|
+
damping?: number;
|
|
22
|
+
stiffness?: number;
|
|
23
|
+
mass?: number;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Animation preset types
|
|
28
|
+
*/
|
|
29
|
+
export enum AnimationPreset {
|
|
30
|
+
FADE_IN = 'fadeIn',
|
|
31
|
+
FADE_OUT = 'fadeOut',
|
|
32
|
+
SLIDE_IN_UP = 'slideInUp',
|
|
33
|
+
SLIDE_IN_DOWN = 'slideInDown',
|
|
34
|
+
SLIDE_IN_LEFT = 'slideInLeft',
|
|
35
|
+
SLIDE_IN_RIGHT = 'slideInRight',
|
|
36
|
+
SCALE_IN = 'scaleIn',
|
|
37
|
+
SCALE_OUT = 'scaleOut',
|
|
38
|
+
BOUNCE = 'bounce',
|
|
39
|
+
SHAKE = 'shake',
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Gesture type
|
|
44
|
+
*/
|
|
45
|
+
export enum GestureType {
|
|
46
|
+
TAP = 'tap',
|
|
47
|
+
PAN = 'pan',
|
|
48
|
+
PINCH = 'pinch',
|
|
49
|
+
ROTATION = 'rotation',
|
|
50
|
+
LONG_PRESS = 'longPress',
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Animation easing functions
|
|
55
|
+
*/
|
|
56
|
+
export enum AnimationEasing {
|
|
57
|
+
LINEAR = 'linear',
|
|
58
|
+
EASE_IN = 'easeIn',
|
|
59
|
+
EASE_OUT = 'easeOut',
|
|
60
|
+
EASE_IN_OUT = 'easeInOut',
|
|
61
|
+
BOUNCE = 'bounce',
|
|
62
|
+
ELASTIC = 'elastic',
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Animation constants
|
|
67
|
+
*/
|
|
68
|
+
export const ANIMATION_CONSTANTS = {
|
|
69
|
+
DURATION: {
|
|
70
|
+
INSTANT: 0,
|
|
71
|
+
FAST: 200,
|
|
72
|
+
NORMAL: 300,
|
|
73
|
+
SLOW: 500,
|
|
74
|
+
VERY_SLOW: 1000,
|
|
75
|
+
},
|
|
76
|
+
SPRING: {
|
|
77
|
+
DAMPING: 10,
|
|
78
|
+
STIFFNESS: 100,
|
|
79
|
+
MASS: 1,
|
|
80
|
+
},
|
|
81
|
+
} as const;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fireworks Domain Entity
|
|
3
|
+
*
|
|
4
|
+
* Types and constants for fireworks particle system
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Particle configuration
|
|
9
|
+
*/
|
|
10
|
+
export interface ParticleConfig {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
color: string;
|
|
14
|
+
size: number;
|
|
15
|
+
velocityX: number;
|
|
16
|
+
velocityY: number;
|
|
17
|
+
life: number;
|
|
18
|
+
decay: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Fireworks configuration
|
|
23
|
+
*/
|
|
24
|
+
export interface FireworksConfig {
|
|
25
|
+
particleCount?: number;
|
|
26
|
+
colors: string[]; // Required - colors must be provided by consumer
|
|
27
|
+
duration?: number;
|
|
28
|
+
particleSize?: number;
|
|
29
|
+
spread?: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Fireworks constants
|
|
34
|
+
*/
|
|
35
|
+
export const FIREWORKS_CONSTANTS = {
|
|
36
|
+
DEFAULT_PARTICLE_COUNT: 50,
|
|
37
|
+
DEFAULT_DURATION: 2000,
|
|
38
|
+
DEFAULT_PARTICLE_SIZE: 4,
|
|
39
|
+
DEFAULT_SPREAD: 100,
|
|
40
|
+
DEFAULT_COLORS: [] as string[], // Colors should be provided by consumer
|
|
41
|
+
GRAVITY: 0.3,
|
|
42
|
+
DECAY_RATE: 0.02,
|
|
43
|
+
} as const;
|
|
44
|
+
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme System for Animation Package
|
|
3
|
+
*
|
|
4
|
+
* Provides theme-aware animation configurations.
|
|
5
|
+
* Consumers can provide their own theme or use defaults.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export interface AnimationTheme {
|
|
9
|
+
colors: {
|
|
10
|
+
primary: string;
|
|
11
|
+
secondary: string;
|
|
12
|
+
success: string;
|
|
13
|
+
warning: string;
|
|
14
|
+
error: string;
|
|
15
|
+
info: string;
|
|
16
|
+
};
|
|
17
|
+
spacing: {
|
|
18
|
+
xs: number;
|
|
19
|
+
sm: number;
|
|
20
|
+
md: number;
|
|
21
|
+
lg: number;
|
|
22
|
+
xl: number;
|
|
23
|
+
};
|
|
24
|
+
borderRadius: {
|
|
25
|
+
sm: number;
|
|
26
|
+
md: number;
|
|
27
|
+
lg: number;
|
|
28
|
+
full: number;
|
|
29
|
+
};
|
|
30
|
+
opacity: {
|
|
31
|
+
transparent: number;
|
|
32
|
+
light: number;
|
|
33
|
+
medium: number;
|
|
34
|
+
heavy: number;
|
|
35
|
+
opaque: number;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const DEFAULT_ANIMATION_THEME: AnimationTheme = {
|
|
40
|
+
colors: {
|
|
41
|
+
primary: '#007AFF',
|
|
42
|
+
secondary: '#5856D6',
|
|
43
|
+
success: '#34C759',
|
|
44
|
+
warning: '#FF9500',
|
|
45
|
+
error: '#FF3B30',
|
|
46
|
+
info: '#5AC8FA',
|
|
47
|
+
},
|
|
48
|
+
spacing: {
|
|
49
|
+
xs: 4,
|
|
50
|
+
sm: 8,
|
|
51
|
+
md: 16,
|
|
52
|
+
lg: 24,
|
|
53
|
+
xl: 32,
|
|
54
|
+
},
|
|
55
|
+
borderRadius: {
|
|
56
|
+
sm: 4,
|
|
57
|
+
md: 8,
|
|
58
|
+
lg: 12,
|
|
59
|
+
full: 9999,
|
|
60
|
+
},
|
|
61
|
+
opacity: {
|
|
62
|
+
transparent: 0,
|
|
63
|
+
light: 0.25,
|
|
64
|
+
medium: 0.5,
|
|
65
|
+
heavy: 0.75,
|
|
66
|
+
opaque: 1,
|
|
67
|
+
},
|
|
68
|
+
} as const;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Theme context for React components
|
|
72
|
+
*/
|
|
73
|
+
export interface ThemeContext {
|
|
74
|
+
theme: AnimationTheme;
|
|
75
|
+
setTheme: (theme: Partial<AnimationTheme>) => void;
|
|
76
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Native Animation - Barrel Export
|
|
3
|
+
*
|
|
4
|
+
* Universal animation system for React Native with react-native-reanimated.
|
|
5
|
+
* Provides declarative animations, gesture handling, and preset configurations.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Declarative animations (fade, slide, scale, bounce, shake)
|
|
9
|
+
* - Spring physics animations
|
|
10
|
+
* - Gesture handling (tap, pan, pinch, long press)
|
|
11
|
+
* - Preset animation configs
|
|
12
|
+
* - TypeScript type safety
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
*
|
|
16
|
+
* Animation Example:
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { useAnimation, Animated } from '@umituz/react-native-animation';
|
|
19
|
+
*
|
|
20
|
+
* const MyComponent = () => {
|
|
21
|
+
* const { fadeIn, animatedStyle } = useAnimation();
|
|
22
|
+
*
|
|
23
|
+
* useEffect(() => {
|
|
24
|
+
* fadeIn();
|
|
25
|
+
* }, []);
|
|
26
|
+
*
|
|
27
|
+
* return <Animated.View style={animatedStyle}>...</Animated.View>;
|
|
28
|
+
* };
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* Gesture Example:
|
|
32
|
+
* ```typescript
|
|
33
|
+
* import { useGesture, Animated } from '@umituz/react-native-animation';
|
|
34
|
+
*
|
|
35
|
+
* const MyComponent = () => {
|
|
36
|
+
* const { createPanGesture, animatedStyle, GestureDetector } = useGesture();
|
|
37
|
+
*
|
|
38
|
+
* const panGesture = createPanGesture({
|
|
39
|
+
* onEnd: (x, y) => console.log('Dragged to:', x, y),
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* return (
|
|
43
|
+
* <GestureDetector gesture={panGesture}>
|
|
44
|
+
* <Animated.View style={animatedStyle}>...</Animated.View>
|
|
45
|
+
* </GestureDetector>
|
|
46
|
+
* );
|
|
47
|
+
* };
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* Technical:
|
|
51
|
+
* - Uses react-native-reanimated v3 for animations
|
|
52
|
+
* - Uses react-native-gesture-handler for gestures
|
|
53
|
+
* - Zero backend dependencies
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
// =============================================================================
|
|
57
|
+
// CORE LAYER - Animation Primitives
|
|
58
|
+
// =============================================================================
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
Animated,
|
|
62
|
+
useSharedValue,
|
|
63
|
+
useAnimatedStyle,
|
|
64
|
+
withTiming,
|
|
65
|
+
withSpring,
|
|
66
|
+
withSequence,
|
|
67
|
+
withRepeat,
|
|
68
|
+
runOnJS,
|
|
69
|
+
cancelAnimation,
|
|
70
|
+
Easing,
|
|
71
|
+
} from './core/AnimationCore';
|
|
72
|
+
|
|
73
|
+
export type {
|
|
74
|
+
SharedValue,
|
|
75
|
+
WithTimingConfig,
|
|
76
|
+
WithSpringConfig,
|
|
77
|
+
} from './core/AnimationCore';
|
|
78
|
+
|
|
79
|
+
// =============================================================================
|
|
80
|
+
// DOMAIN LAYER - Entities
|
|
81
|
+
// =============================================================================
|
|
82
|
+
|
|
83
|
+
export {
|
|
84
|
+
AnimationPreset,
|
|
85
|
+
GestureType,
|
|
86
|
+
AnimationEasing,
|
|
87
|
+
ANIMATION_CONSTANTS,
|
|
88
|
+
} from './domain/entities/Animation';
|
|
89
|
+
export type {
|
|
90
|
+
AnimationTimingConfig,
|
|
91
|
+
AnimationSpringConfig,
|
|
92
|
+
} from './domain/entities/Animation';
|
|
93
|
+
|
|
94
|
+
// Infrastructure Layer - Services
|
|
95
|
+
export { AnimationConfigService } from './infrastructure/services/AnimationConfigService';
|
|
96
|
+
export { TimingAnimationConfigService } from './infrastructure/services/TimingAnimationConfigService';
|
|
97
|
+
export { SpringAnimationConfigService } from './infrastructure/services/SpringAnimationConfigService';
|
|
98
|
+
|
|
99
|
+
// Presentation Layer - Hooks
|
|
100
|
+
export { useAnimation } from './presentation/hooks/useAnimation';
|
|
101
|
+
export {
|
|
102
|
+
useGesture,
|
|
103
|
+
type TapGestureOptions,
|
|
104
|
+
type PanGestureOptions,
|
|
105
|
+
type PinchGestureOptions,
|
|
106
|
+
} from './presentation/hooks/useGesture';
|
|
107
|
+
export { useReanimatedReady } from './presentation/hooks/useReanimatedReady';
|
|
108
|
+
export { useFireworks } from './presentation/hooks/useFireworks';
|
|
109
|
+
export {
|
|
110
|
+
useOverlayAnimations,
|
|
111
|
+
useModalAnimations, // Legacy
|
|
112
|
+
type OverlayAnimationConfig,
|
|
113
|
+
type UseOverlayAnimationsReturn,
|
|
114
|
+
type ModalAnimationConfig, // Legacy
|
|
115
|
+
type UseModalAnimationsReturn, // Legacy
|
|
116
|
+
} from './presentation/hooks/useModalAnimations';
|
|
117
|
+
export {
|
|
118
|
+
useElementAnimations,
|
|
119
|
+
useIconAnimations, // Legacy
|
|
120
|
+
type ElementAnimationConfig,
|
|
121
|
+
type UseElementAnimationsReturn,
|
|
122
|
+
type IconAnimationConfig, // Legacy
|
|
123
|
+
type UseIconAnimationsReturn, // Legacy
|
|
124
|
+
} from './presentation/hooks/useIconAnimations';
|
|
125
|
+
|
|
126
|
+
// Presentation Layer - Components
|
|
127
|
+
export { Fireworks } from './presentation/components/Fireworks';
|
|
128
|
+
export type { FireworksProps } from './presentation/components/Fireworks';
|
|
129
|
+
|
|
130
|
+
// Domain Layer - Fireworks
|
|
131
|
+
export type {
|
|
132
|
+
ParticleConfig,
|
|
133
|
+
FireworksConfig,
|
|
134
|
+
} from './domain/entities/Fireworks';
|
|
135
|
+
export { FIREWORKS_CONSTANTS } from './domain/entities/Fireworks';
|
|
136
|
+
|
|
137
|
+
// Domain Layer - Theme
|
|
138
|
+
export type {
|
|
139
|
+
AnimationTheme,
|
|
140
|
+
ThemeContext,
|
|
141
|
+
} from './domain/entities/Theme';
|
|
142
|
+
export { DEFAULT_ANIMATION_THEME } from './domain/entities/Theme';
|
|
143
|
+
|
|
144
|
+
// Presentation Layer - Providers
|
|
145
|
+
export { AnimationThemeProvider, useAnimationTheme } from './presentation/providers/AnimationThemeProvider';
|
|
146
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Animation Config Service (Legacy)
|
|
3
|
+
*
|
|
4
|
+
* Legacy service for backward compatibility.
|
|
5
|
+
* New implementations should use TimingAnimationConfigService and SpringAnimationConfigService.
|
|
6
|
+
* @deprecated Use TimingAnimationConfigService and SpringAnimationConfigService instead
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
AnimationTimingConfig,
|
|
11
|
+
AnimationSpringConfig,
|
|
12
|
+
} from '../../domain/entities/Animation';
|
|
13
|
+
import { AnimationPreset } from '../../domain/entities/Animation';
|
|
14
|
+
import { TimingAnimationConfigService } from './TimingAnimationConfigService';
|
|
15
|
+
import { SpringAnimationConfigService } from './SpringAnimationConfigService';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use TimingAnimationConfigService and SpringAnimationConfigService instead
|
|
19
|
+
*/
|
|
20
|
+
export class AnimationConfigService {
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Use TimingAnimationConfigService.getTimingConfig instead
|
|
23
|
+
*/
|
|
24
|
+
static getTimingConfig(preset: AnimationPreset): AnimationTimingConfig {
|
|
25
|
+
return TimingAnimationConfigService.getTimingConfig(preset);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Use SpringAnimationConfigService.getSpringConfig instead
|
|
30
|
+
*/
|
|
31
|
+
static getSpringConfig(preset: AnimationPreset): AnimationSpringConfig {
|
|
32
|
+
return SpringAnimationConfigService.getSpringConfig(preset);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spring Animation Config Service
|
|
3
|
+
*
|
|
4
|
+
* Infrastructure service for spring animation configurations.
|
|
5
|
+
* Separates spring configuration logic from domain entities.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { AnimationSpringConfig } from '../../domain/entities/Animation';
|
|
9
|
+
import {
|
|
10
|
+
AnimationPreset,
|
|
11
|
+
ANIMATION_CONSTANTS,
|
|
12
|
+
} from '../../domain/entities/Animation';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Service for providing spring animation configurations
|
|
16
|
+
*/
|
|
17
|
+
export class SpringAnimationConfigService {
|
|
18
|
+
/**
|
|
19
|
+
* Get preset spring config
|
|
20
|
+
*/
|
|
21
|
+
static getSpringConfig(preset: AnimationPreset): AnimationSpringConfig {
|
|
22
|
+
const configs: Record<AnimationPreset, AnimationSpringConfig> = {
|
|
23
|
+
[AnimationPreset.FADE_IN]: {
|
|
24
|
+
damping: ANIMATION_CONSTANTS.SPRING.DAMPING,
|
|
25
|
+
stiffness: ANIMATION_CONSTANTS.SPRING.STIFFNESS,
|
|
26
|
+
},
|
|
27
|
+
[AnimationPreset.FADE_OUT]: {
|
|
28
|
+
damping: ANIMATION_CONSTANTS.SPRING.DAMPING,
|
|
29
|
+
stiffness: ANIMATION_CONSTANTS.SPRING.STIFFNESS,
|
|
30
|
+
},
|
|
31
|
+
[AnimationPreset.SLIDE_IN_UP]: {
|
|
32
|
+
damping: ANIMATION_CONSTANTS.SPRING.DAMPING,
|
|
33
|
+
stiffness: ANIMATION_CONSTANTS.SPRING.STIFFNESS,
|
|
34
|
+
},
|
|
35
|
+
[AnimationPreset.SLIDE_IN_DOWN]: {
|
|
36
|
+
damping: ANIMATION_CONSTANTS.SPRING.DAMPING,
|
|
37
|
+
stiffness: ANIMATION_CONSTANTS.SPRING.STIFFNESS,
|
|
38
|
+
},
|
|
39
|
+
[AnimationPreset.SLIDE_IN_LEFT]: {
|
|
40
|
+
damping: ANIMATION_CONSTANTS.SPRING.DAMPING,
|
|
41
|
+
stiffness: ANIMATION_CONSTANTS.SPRING.STIFFNESS,
|
|
42
|
+
},
|
|
43
|
+
[AnimationPreset.SLIDE_IN_RIGHT]: {
|
|
44
|
+
damping: ANIMATION_CONSTANTS.SPRING.DAMPING,
|
|
45
|
+
stiffness: ANIMATION_CONSTANTS.SPRING.STIFFNESS,
|
|
46
|
+
},
|
|
47
|
+
[AnimationPreset.SCALE_IN]: {
|
|
48
|
+
damping: 15,
|
|
49
|
+
stiffness: 150,
|
|
50
|
+
},
|
|
51
|
+
[AnimationPreset.SCALE_OUT]: {
|
|
52
|
+
damping: 15,
|
|
53
|
+
stiffness: 150,
|
|
54
|
+
},
|
|
55
|
+
[AnimationPreset.BOUNCE]: {
|
|
56
|
+
damping: 5,
|
|
57
|
+
stiffness: 120,
|
|
58
|
+
},
|
|
59
|
+
[AnimationPreset.SHAKE]: {
|
|
60
|
+
damping: 8,
|
|
61
|
+
stiffness: 200,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return configs[preset];
|
|
66
|
+
}
|
|
67
|
+
}
|