@umituz/react-native-design-system 2.6.47 → 2.6.49

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 (47) hide show
  1. package/package.json +1 -1
  2. package/src/atoms/skeleton/AtomicSkeleton.tsx +16 -62
  3. package/src/index.ts +0 -32
  4. package/src/molecules/bottom-sheet/components/BottomSheetModal.tsx +101 -180
  5. package/src/molecules/bottom-sheet/components/SafeBottomSheetModalProvider.tsx +8 -14
  6. package/src/molecules/index.ts +0 -6
  7. package/src/molecules/animation/core/AnimationCore.ts +0 -29
  8. package/src/molecules/animation/domain/entities/Animation.ts +0 -81
  9. package/src/molecules/animation/domain/entities/Fireworks.ts +0 -44
  10. package/src/molecules/animation/domain/entities/Theme.ts +0 -76
  11. package/src/molecules/animation/index.ts +0 -146
  12. package/src/molecules/animation/infrastructure/services/AnimationConfigService.ts +0 -35
  13. package/src/molecules/animation/infrastructure/services/SpringAnimationConfigService.ts +0 -67
  14. package/src/molecules/animation/infrastructure/services/TimingAnimationConfigService.ts +0 -57
  15. package/src/molecules/animation/infrastructure/services/__tests__/SpringAnimationConfigService.test.ts +0 -114
  16. package/src/molecules/animation/infrastructure/services/__tests__/TimingAnimationConfigService.test.ts +0 -105
  17. package/src/molecules/animation/presentation/components/Fireworks.tsx +0 -127
  18. package/src/molecules/animation/presentation/components/__tests__/Fireworks.test.tsx +0 -185
  19. package/src/molecules/animation/presentation/hooks/__tests__/useAnimation.integration.test.ts +0 -210
  20. package/src/molecules/animation/presentation/hooks/__tests__/useFireworks.test.ts +0 -242
  21. package/src/molecules/animation/presentation/hooks/__tests__/useGesture.test.ts +0 -108
  22. package/src/molecules/animation/presentation/hooks/__tests__/useSpringAnimation.test.ts +0 -127
  23. package/src/molecules/animation/presentation/hooks/__tests__/useTimingAnimation.test.ts +0 -172
  24. package/src/molecules/animation/presentation/hooks/__tests__/useTransformAnimation.test.ts +0 -133
  25. package/src/molecules/animation/presentation/hooks/useAnimation.ts +0 -77
  26. package/src/molecules/animation/presentation/hooks/useFireworks.ts +0 -144
  27. package/src/molecules/animation/presentation/hooks/useGesture.ts +0 -57
  28. package/src/molecules/animation/presentation/hooks/useGestureCreators.ts +0 -163
  29. package/src/molecules/animation/presentation/hooks/useGestureState.ts +0 -53
  30. package/src/molecules/animation/presentation/hooks/useIconAnimations.ts +0 -120
  31. package/src/molecules/animation/presentation/hooks/useModalAnimations.ts +0 -124
  32. package/src/molecules/animation/presentation/hooks/useReanimatedReady.ts +0 -60
  33. package/src/molecules/animation/presentation/hooks/useSpringAnimation.ts +0 -69
  34. package/src/molecules/animation/presentation/hooks/useTimingAnimation.ts +0 -111
  35. package/src/molecules/animation/presentation/hooks/useTransformAnimation.ts +0 -57
  36. package/src/molecules/animation/presentation/providers/AnimationThemeProvider.tsx +0 -60
  37. package/src/molecules/animation/presentation/providers/__tests__/AnimationThemeProvider.test.tsx +0 -165
  38. package/src/molecules/celebration/domain/entities/CelebrationConfig.ts +0 -17
  39. package/src/molecules/celebration/domain/entities/FireworksConfig.ts +0 -32
  40. package/src/molecules/celebration/index.ts +0 -93
  41. package/src/molecules/celebration/infrastructure/services/FireworksConfigService.ts +0 -49
  42. package/src/molecules/celebration/presentation/components/CelebrationFireworksOverlay.tsx +0 -33
  43. package/src/molecules/celebration/presentation/components/CelebrationModal.tsx +0 -81
  44. package/src/molecules/celebration/presentation/components/CelebrationModalContent.tsx +0 -88
  45. package/src/molecules/celebration/presentation/hooks/useCelebrationModalAnimation.ts +0 -49
  46. package/src/molecules/celebration/presentation/hooks/useCelebrationState.ts +0 -45
  47. package/src/molecules/celebration/presentation/styles/CelebrationModalStyles.ts +0 -65
@@ -1,127 +0,0 @@
1
- /**
2
- * Fireworks Component
3
- *
4
- * Particle-based fireworks animation component.
5
- * Single Responsibility: Render fireworks particles.
6
- */
7
-
8
- import React from 'react';
9
- import { View, StyleSheet } from 'react-native';
10
- import Animated, { useAnimatedStyle, withTiming } from 'react-native-reanimated';
11
- import { useFireworks } from '../hooks/useFireworks';
12
- import type { FireworksConfig } from '../../domain/entities/Fireworks';
13
-
14
- const AnimatedView = (Animated as any).createAnimatedComponent(View);
15
-
16
- export interface FireworksProps extends FireworksConfig {
17
- /**
18
- * X position to trigger fireworks (0-1, relative to container width)
19
- */
20
- triggerX?: number;
21
- /**
22
- * Y position to trigger fireworks (0-1, relative to container height)
23
- */
24
- triggerY?: number;
25
- /**
26
- * Auto-trigger on mount
27
- */
28
- autoTrigger?: boolean;
29
- /**
30
- * Container style
31
- */
32
- style?: any;
33
- /**
34
- * Test ID
35
- */
36
- testID?: string;
37
- }
38
-
39
- /**
40
- * Particle Component
41
- */
42
- const Particle: React.FC<{
43
- x: number;
44
- y: number;
45
- color: string;
46
- size: number;
47
- opacity: number;
48
- }> = ({ x, y, color, size, opacity }) => {
49
- const animatedStyle = useAnimatedStyle(() => ({
50
- position: 'absolute',
51
- left: x,
52
- top: y,
53
- width: size,
54
- height: size,
55
- backgroundColor: color,
56
- borderRadius: size / 2,
57
- opacity: withTiming(opacity, { duration: 100 }),
58
- }));
59
-
60
- return <AnimatedView style={animatedStyle} />;
61
- };
62
-
63
- /**
64
- * Fireworks Component
65
- *
66
- * @example
67
- * <Fireworks
68
- * autoTrigger
69
- * particleCount={100}
70
- * colors={['#FF6B6B', '#4ECDC4']}
71
- * />
72
- */
73
- export const Fireworks: React.FC<FireworksProps> = ({
74
- triggerX = 0.5,
75
- triggerY = 0.5,
76
- autoTrigger = false,
77
- style,
78
- testID = 'fireworks',
79
- ...config
80
- }) => {
81
- const { particles, trigger } = useFireworks(config);
82
- const [containerSize, setContainerSize] = React.useState({ width: 0, height: 0 });
83
-
84
- React.useEffect(() => {
85
- if (autoTrigger && containerSize.width > 0 && containerSize.height > 0) {
86
- const x = containerSize.width * triggerX;
87
- const y = containerSize.height * triggerY;
88
- trigger(x, y);
89
- }
90
- }, [autoTrigger, containerSize, triggerX, triggerY, trigger]);
91
-
92
- const handleLayout = (event: any) => {
93
- const { width, height } = event.nativeEvent.layout;
94
- setContainerSize({ width, height });
95
- };
96
-
97
- return (
98
- <View
99
- style={[styles.container, style]}
100
- onLayout={handleLayout}
101
- testID={testID}
102
- pointerEvents="none"
103
- >
104
- {particles.map((particle, index) => (
105
- <Particle
106
- key={`particle-${index}`}
107
- x={particle.x}
108
- y={particle.y}
109
- color={particle.color}
110
- size={particle.size}
111
- opacity={particle.life}
112
- />
113
- ))}
114
- </View>
115
- );
116
- };
117
-
118
- const styles = StyleSheet.create({
119
- container: {
120
- position: 'absolute',
121
- top: 0,
122
- left: 0,
123
- right: 0,
124
- bottom: 0,
125
- overflow: 'hidden',
126
- },
127
- });
@@ -1,185 +0,0 @@
1
- /**
2
- * Fireworks Component Tests
3
- *
4
- * Unit tests for fireworks particle system.
5
- */
6
-
7
- import React from 'react';
8
- import { render, fireEvent } from '@testing-library/react-native';
9
- import { Fireworks } from '../Fireworks';
10
- import { useFireworks } from '../../hooks/useFireworks';
11
-
12
- // Mock react-native-reanimated
13
- jest.mock('react-native-reanimated', () => ({
14
- useAnimatedStyle: jest.fn((styleFactory) => styleFactory()),
15
- withTiming: jest.fn((toValue, config) => ({ toValue, config })),
16
- }));
17
-
18
- // Mock useFireworks hook
19
- jest.mock('../../hooks/useFireworks', () => ({
20
- useFireworks: jest.fn(() => ({
21
- particles: [
22
- { x: 100, y: 100, color: '#FF0000', size: 4, life: 1 },
23
- { x: 150, y: 150, color: '#00FF00', size: 6, life: 0.5 },
24
- ],
25
- trigger: jest.fn(),
26
- isActive: true,
27
- })),
28
- }));
29
-
30
- describe('Fireworks Component', () => {
31
- const defaultProps = {
32
- colors: ['#FF0000', '#00FF00', '#0000FF'],
33
- testID: 'test-fireworks',
34
- };
35
-
36
- beforeEach(() => {
37
- jest.clearAllMocks();
38
- });
39
-
40
- it('should render correctly', () => {
41
- const { getByTestId } = render(<Fireworks {...defaultProps} />);
42
-
43
- expect(getByTestId('test-fireworks')).toBeTruthy();
44
- });
45
-
46
- it('should render particles', () => {
47
- const { getAllByTestId } = render(<Fireworks {...defaultProps} />);
48
-
49
- const particles = getAllByTestId(/particle-/);
50
- expect(particles).toHaveLength(2);
51
- });
52
-
53
- it('should use default props when not provided', () => {
54
- const { getByTestId } = render(
55
- <Fireworks colors={['#FF0000']} />
56
- );
57
-
58
- expect(getByTestId('fireworks')).toBeTruthy();
59
- });
60
-
61
- it('should apply custom styles', () => {
62
- const customStyle = { backgroundColor: 'blue' };
63
- const { getByTestId } = render(
64
- <Fireworks
65
- colors={['#FF0000']}
66
- style={customStyle}
67
- />
68
- );
69
-
70
- const container = getByTestId('fireworks');
71
- expect(container.props.style).toEqual(
72
- expect.arrayContaining([customStyle])
73
- );
74
- });
75
-
76
- it('should handle layout changes', () => {
77
- const { getByTestId } = render(<Fireworks {...defaultProps} />);
78
- const container = getByTestId('test-fireworks');
79
-
80
- fireEvent(container, 'layout', {
81
- nativeEvent: {
82
- layout: { width: 300, height: 400 }
83
- }
84
- });
85
- });
86
-
87
- it('should have pointerEvents disabled', () => {
88
- const { getByTestId } = render(<Fireworks {...defaultProps} />);
89
- const container = getByTestId('test-fireworks');
90
-
91
- expect(container.props.pointerEvents).toBe('none');
92
- });
93
-
94
- describe('autoTrigger', () => {
95
- it('should trigger fireworks when autoTrigger is true and container has size', () => {
96
- const mockTrigger = jest.fn();
97
- (useFireworks as jest.Mock).mockReturnValue({
98
- particles: [],
99
- trigger: mockTrigger,
100
- isActive: false,
101
- });
102
-
103
- const { getByTestId } = render(
104
- <Fireworks
105
- colors={['#FF0000']}
106
- autoTrigger={true}
107
- />
108
- );
109
-
110
- const container = getByTestId('fireworks');
111
- fireEvent(container, 'layout', {
112
- nativeEvent: {
113
- layout: { width: 300, height: 400 }
114
- }
115
- });
116
-
117
- expect(mockTrigger).toHaveBeenCalledWith(150, 200); // center of container
118
- });
119
-
120
- it('should not trigger when autoTrigger is false', () => {
121
- const mockTrigger = jest.fn();
122
- (useFireworks as jest.Mock).mockReturnValue({
123
- particles: [],
124
- trigger: mockTrigger,
125
- isActive: false,
126
- });
127
-
128
- render(
129
- <Fireworks
130
- colors={['#FF0000']}
131
- autoTrigger={false}
132
- />
133
- );
134
-
135
- expect(mockTrigger).not.toHaveBeenCalled();
136
- });
137
-
138
- it('should use custom trigger position', () => {
139
- const mockTrigger = jest.fn();
140
- (useFireworks as jest.Mock).mockReturnValue({
141
- particles: [],
142
- trigger: mockTrigger,
143
- isActive: false,
144
- });
145
-
146
- const { getByTestId } = render(
147
- <Fireworks
148
- colors={['#FF0000']}
149
- autoTrigger={true}
150
- triggerX={0.25}
151
- triggerY={0.75}
152
- />
153
- );
154
-
155
- const container = getByTestId('fireworks');
156
- fireEvent(container, 'layout', {
157
- nativeEvent: {
158
- layout: { width: 400, height: 200 }
159
- }
160
- });
161
-
162
- expect(mockTrigger).toHaveBeenCalledWith(100, 150); // 25% of width, 75% of height
163
- });
164
- });
165
-
166
- describe('Particle rendering', () => {
167
- it('should render particle with correct properties', () => {
168
- const particles = [
169
- { x: 100, y: 100, color: '#FF0000', size: 4, life: 1 },
170
- ];
171
- (useFireworks as jest.Mock).mockReturnValue({
172
- particles,
173
- trigger: jest.fn(),
174
- isActive: false,
175
- });
176
-
177
- render(<Fireworks colors={['#FF0000']} />);
178
-
179
- // Particle should be rendered with correct properties
180
- expect(useFireworks).toHaveBeenCalledWith({
181
- colors: ['#FF0000'],
182
- });
183
- });
184
- });
185
- });
@@ -1,210 +0,0 @@
1
- /**
2
- * useAnimation Hook Integration Tests
3
- *
4
- * Integration tests for combined animation functionality.
5
- */
6
-
7
- import { renderHook, act } from '@testing-library/react';
8
- import { useAnimation } from '../useAnimation';
9
- import { useTimingAnimation } from '../useTimingAnimation';
10
- import { useSpringAnimation } from '../useSpringAnimation';
11
- import { useTransformAnimation } from '../useTransformAnimation';
12
- import { useAnimatedStyle } from 'react-native-reanimated';
13
-
14
- // Mock react-native-reanimated
15
- jest.mock('react-native-reanimated', () => ({
16
- useSharedValue: jest.fn((initialValue) => ({
17
- value: initialValue,
18
- })),
19
- useAnimatedStyle: jest.fn((styleFactory) => styleFactory()),
20
- withTiming: jest.fn((toValue, config) => ({ toValue, config })),
21
- withSpring: jest.fn((toValue, config) => ({ toValue, config })),
22
- withSequence: jest.fn((...animations) => animations),
23
- withRepeat: jest.fn((animation, count, reverse) => ({ animation, count, reverse })),
24
- Easing: {
25
- ease: jest.fn(),
26
- out: jest.fn((easing) => easing),
27
- bezier: jest.fn(() => jest.fn()),
28
- linear: jest.fn(),
29
- },
30
- }));
31
-
32
- // Define singleton mock objects
33
- const mockTiming = {
34
- fadeIn: jest.fn(),
35
- fadeOut: jest.fn(),
36
- slideInUp: jest.fn(),
37
- slideInDown: jest.fn(),
38
- slideInLeft: jest.fn(),
39
- slideInRight: jest.fn(),
40
- opacity: { value: 1 },
41
- translateY: { value: 0 },
42
- translateX: { value: 0 },
43
- };
44
-
45
- const mockSpring = {
46
- scaleIn: jest.fn(),
47
- scaleOut: jest.fn(),
48
- bounce: jest.fn(),
49
- scale: { value: 1 },
50
- };
51
-
52
- const mockTransform = {
53
- shake: jest.fn(),
54
- pulse: jest.fn(),
55
- spin: jest.fn(),
56
- translateX: { value: 0 },
57
- scale: { value: 1 },
58
- rotate: { value: 0 },
59
- };
60
-
61
- // Mock all sub-hooks
62
- jest.mock('../useTimingAnimation', () => ({
63
- useTimingAnimation: jest.fn(() => mockTiming),
64
- }));
65
-
66
- jest.mock('../useSpringAnimation', () => ({
67
- useSpringAnimation: jest.fn(() => mockSpring),
68
- }));
69
-
70
- jest.mock('../useTransformAnimation', () => ({
71
- useTransformAnimation: jest.fn(() => mockTransform),
72
- }));
73
-
74
- describe('useAnimation Integration', () => {
75
- beforeEach(() => {
76
- jest.clearAllMocks();
77
- });
78
-
79
- it('should integrate all animation hooks', () => {
80
- renderHook(() => useAnimation());
81
-
82
- expect(useTimingAnimation).toHaveBeenCalled();
83
- expect(useSpringAnimation).toHaveBeenCalled();
84
- expect(useTransformAnimation).toHaveBeenCalled();
85
- });
86
-
87
- it('should provide all timing animations', () => {
88
- const { result } = renderHook(() => useAnimation());
89
-
90
- expect(typeof result.current.fadeIn).toBe('function');
91
- expect(typeof result.current.fadeOut).toBe('function');
92
- expect(typeof result.current.slideInUp).toBe('function');
93
- expect(typeof result.current.slideInDown).toBe('function');
94
- expect(typeof result.current.slideInLeft).toBe('function');
95
- expect(typeof result.current.slideInRight).toBe('function');
96
- });
97
-
98
- it('should provide all spring animations', () => {
99
- const { result } = renderHook(() => useAnimation());
100
-
101
- expect(typeof result.current.scaleIn).toBe('function');
102
- expect(typeof result.current.scaleOut).toBe('function');
103
- expect(typeof result.current.bounce).toBe('function');
104
- });
105
-
106
- it('should provide all transform animations', () => {
107
- const { result } = renderHook(() => useAnimation());
108
-
109
- expect(typeof result.current.shake).toBe('function');
110
- expect(typeof result.current.pulse).toBe('function');
111
- expect(typeof result.current.spin).toBe('function');
112
- });
113
-
114
- it('should provide all shared values', () => {
115
- const { result } = renderHook(() => useAnimation());
116
-
117
- expect(result.current.opacity).toBeDefined();
118
- expect(result.current.translateY).toBeDefined();
119
- expect(result.current.translateX).toBeDefined();
120
- expect(result.current.scale).toBeDefined();
121
- expect(result.current.rotate).toBeDefined();
122
- });
123
-
124
- it('should provide animated style', () => {
125
- const { result } = renderHook(() => useAnimation());
126
-
127
- expect(typeof result.current.animatedStyle).toBe('function');
128
- expect(useAnimatedStyle).toHaveBeenCalled();
129
- });
130
-
131
- describe('animation combinations', () => {
132
- it('should allow combining fade and scale animations', () => {
133
- const { result } = renderHook(() => useAnimation());
134
-
135
- act(() => {
136
- result.current.fadeIn();
137
- result.current.scaleIn();
138
- });
139
-
140
- expect(mockTiming.fadeIn).toHaveBeenCalled();
141
- expect(mockSpring.scaleIn).toHaveBeenCalled();
142
- });
143
-
144
- it('should allow combining slide and rotate animations', () => {
145
- const { result } = renderHook(() => useAnimation());
146
-
147
- act(() => {
148
- result.current.slideInUp();
149
- result.current.spin();
150
- });
151
-
152
- expect(mockTiming.slideInUp).toHaveBeenCalled();
153
- expect(mockTransform.spin).toHaveBeenCalled();
154
- });
155
-
156
- it('should allow complex animation sequences', () => {
157
- const { result } = renderHook(() => useAnimation());
158
-
159
- act(() => {
160
- result.current.fadeIn();
161
- result.current.slideInUp();
162
- result.current.scaleIn();
163
- result.current.bounce();
164
- result.current.shake();
165
- result.current.pulse();
166
- result.current.spin();
167
- });
168
-
169
- expect(mockTiming.fadeIn).toHaveBeenCalled();
170
- expect(mockTiming.slideInUp).toHaveBeenCalled();
171
- expect(mockSpring.scaleIn).toHaveBeenCalled();
172
- expect(mockSpring.bounce).toHaveBeenCalled();
173
- expect(mockTransform.shake).toHaveBeenCalled();
174
- expect(mockTransform.pulse).toHaveBeenCalled();
175
- expect(mockTransform.spin).toHaveBeenCalled();
176
- });
177
- });
178
-
179
- describe('animated style composition', () => {
180
- it('should compose styles from all animation types', () => {
181
- const mockStyle = {
182
- opacity: 1,
183
- transform: [
184
- { translateY: 0 },
185
- { translateX: 0 },
186
- { scale: 1 },
187
- { rotate: '0deg' },
188
- ],
189
- };
190
-
191
- (useAnimatedStyle as jest.Mock).mockReturnValue(mockStyle);
192
-
193
- const { result } = renderHook(() => useAnimation());
194
-
195
- expect(result.current.animatedStyle).toBe(mockStyle);
196
- });
197
-
198
- it('should prioritize transform values over timing/spring values', () => {
199
- // Set transform values to non-default
200
- mockTransform.translateX.value = 50;
201
- mockTransform.scale.value = 1.5;
202
-
203
- renderHook(() => useAnimation());
204
-
205
- expect(useAnimatedStyle).toHaveBeenCalledWith(
206
- expect.any(Function)
207
- );
208
- });
209
- });
210
- });