@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.
- package/package.json +1 -1
- package/src/atoms/skeleton/AtomicSkeleton.tsx +16 -62
- package/src/index.ts +0 -32
- package/src/molecules/bottom-sheet/components/BottomSheetModal.tsx +101 -180
- package/src/molecules/bottom-sheet/components/SafeBottomSheetModalProvider.tsx +8 -14
- package/src/molecules/index.ts +0 -6
- package/src/molecules/animation/core/AnimationCore.ts +0 -29
- package/src/molecules/animation/domain/entities/Animation.ts +0 -81
- package/src/molecules/animation/domain/entities/Fireworks.ts +0 -44
- package/src/molecules/animation/domain/entities/Theme.ts +0 -76
- package/src/molecules/animation/index.ts +0 -146
- package/src/molecules/animation/infrastructure/services/AnimationConfigService.ts +0 -35
- package/src/molecules/animation/infrastructure/services/SpringAnimationConfigService.ts +0 -67
- package/src/molecules/animation/infrastructure/services/TimingAnimationConfigService.ts +0 -57
- package/src/molecules/animation/infrastructure/services/__tests__/SpringAnimationConfigService.test.ts +0 -114
- package/src/molecules/animation/infrastructure/services/__tests__/TimingAnimationConfigService.test.ts +0 -105
- package/src/molecules/animation/presentation/components/Fireworks.tsx +0 -127
- package/src/molecules/animation/presentation/components/__tests__/Fireworks.test.tsx +0 -185
- package/src/molecules/animation/presentation/hooks/__tests__/useAnimation.integration.test.ts +0 -210
- package/src/molecules/animation/presentation/hooks/__tests__/useFireworks.test.ts +0 -242
- package/src/molecules/animation/presentation/hooks/__tests__/useGesture.test.ts +0 -108
- package/src/molecules/animation/presentation/hooks/__tests__/useSpringAnimation.test.ts +0 -127
- package/src/molecules/animation/presentation/hooks/__tests__/useTimingAnimation.test.ts +0 -172
- package/src/molecules/animation/presentation/hooks/__tests__/useTransformAnimation.test.ts +0 -133
- package/src/molecules/animation/presentation/hooks/useAnimation.ts +0 -77
- package/src/molecules/animation/presentation/hooks/useFireworks.ts +0 -144
- package/src/molecules/animation/presentation/hooks/useGesture.ts +0 -57
- package/src/molecules/animation/presentation/hooks/useGestureCreators.ts +0 -163
- package/src/molecules/animation/presentation/hooks/useGestureState.ts +0 -53
- package/src/molecules/animation/presentation/hooks/useIconAnimations.ts +0 -120
- package/src/molecules/animation/presentation/hooks/useModalAnimations.ts +0 -124
- package/src/molecules/animation/presentation/hooks/useReanimatedReady.ts +0 -60
- package/src/molecules/animation/presentation/hooks/useSpringAnimation.ts +0 -69
- package/src/molecules/animation/presentation/hooks/useTimingAnimation.ts +0 -111
- package/src/molecules/animation/presentation/hooks/useTransformAnimation.ts +0 -57
- package/src/molecules/animation/presentation/providers/AnimationThemeProvider.tsx +0 -60
- package/src/molecules/animation/presentation/providers/__tests__/AnimationThemeProvider.test.tsx +0 -165
- package/src/molecules/celebration/domain/entities/CelebrationConfig.ts +0 -17
- package/src/molecules/celebration/domain/entities/FireworksConfig.ts +0 -32
- package/src/molecules/celebration/index.ts +0 -93
- package/src/molecules/celebration/infrastructure/services/FireworksConfigService.ts +0 -49
- package/src/molecules/celebration/presentation/components/CelebrationFireworksOverlay.tsx +0 -33
- package/src/molecules/celebration/presentation/components/CelebrationModal.tsx +0 -81
- package/src/molecules/celebration/presentation/components/CelebrationModalContent.tsx +0 -88
- package/src/molecules/celebration/presentation/hooks/useCelebrationModalAnimation.ts +0 -49
- package/src/molecules/celebration/presentation/hooks/useCelebrationState.ts +0 -45
- package/src/molecules/celebration/presentation/styles/CelebrationModalStyles.ts +0 -65
package/src/molecules/animation/presentation/providers/__tests__/AnimationThemeProvider.test.tsx
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AnimationThemeProvider Tests
|
|
3
|
-
*
|
|
4
|
-
* Unit tests for theme system functionality.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { render, screen } from '@testing-library/react-native';
|
|
9
|
-
import { AnimationThemeProvider, useAnimationTheme } from '../AnimationThemeProvider';
|
|
10
|
-
import { DEFAULT_ANIMATION_THEME } from '../../../domain/entities/AnimationTheme';
|
|
11
|
-
|
|
12
|
-
// Mock console.warn
|
|
13
|
-
const originalWarn = console.warn;
|
|
14
|
-
beforeEach(() => {
|
|
15
|
-
console.warn = jest.fn();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
afterEach(() => {
|
|
19
|
-
console.warn = originalWarn;
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
describe('AnimationThemeProvider', () => {
|
|
23
|
-
it('should render children', () => {
|
|
24
|
-
const TestComponent = () => <div>Test Child</div>;
|
|
25
|
-
|
|
26
|
-
render(
|
|
27
|
-
<AnimationThemeProvider>
|
|
28
|
-
<TestComponent />
|
|
29
|
-
</AnimationThemeProvider>
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
expect(screen.getByText('Test Child')).toBeTruthy();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('should provide default theme when no custom theme provided', () => {
|
|
36
|
-
const TestComponent = () => {
|
|
37
|
-
const { theme } = useAnimationTheme();
|
|
38
|
-
return <div>{theme.colors.primary}</div>;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
render(
|
|
42
|
-
<AnimationThemeProvider>
|
|
43
|
-
<TestComponent />
|
|
44
|
-
</AnimationThemeProvider>
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
expect(screen.getByText(DEFAULT_ANIMATION_THEME.colors.primary)).toBeTruthy();
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('should merge custom theme with default theme', () => {
|
|
51
|
-
const customTheme = {
|
|
52
|
-
colors: {
|
|
53
|
-
primary: '#custom-color',
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const TestComponent = () => {
|
|
58
|
-
const { theme } = useAnimationTheme();
|
|
59
|
-
return <div>{theme.colors.primary}</div>;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
render(
|
|
63
|
-
<AnimationThemeProvider theme={customTheme}>
|
|
64
|
-
<TestComponent />
|
|
65
|
-
</AnimationThemeProvider>
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
expect(screen.getByText('#custom-color')).toBeTruthy();
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('should preserve default values for non-overridden properties', () => {
|
|
72
|
-
const customTheme = {
|
|
73
|
-
colors: {
|
|
74
|
-
primary: '#custom-color',
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const TestComponent = () => {
|
|
79
|
-
const { theme } = useAnimationTheme();
|
|
80
|
-
return <div>{theme.colors.secondary}</div>;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
render(
|
|
84
|
-
<AnimationThemeProvider theme={customTheme}>
|
|
85
|
-
<TestComponent />
|
|
86
|
-
</AnimationThemeProvider>
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
expect(screen.getByText(DEFAULT_ANIMATION_THEME.colors.secondary)).toBeTruthy();
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('should allow theme updates', () => {
|
|
93
|
-
const TestComponent = () => {
|
|
94
|
-
const { theme, setTheme } = useAnimationTheme();
|
|
95
|
-
|
|
96
|
-
React.useEffect(() => {
|
|
97
|
-
setTheme({ colors: { primary: '#updated-color' } });
|
|
98
|
-
}, [setTheme]);
|
|
99
|
-
|
|
100
|
-
return <div>{theme.colors.primary}</div>;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
render(
|
|
104
|
-
<AnimationThemeProvider>
|
|
105
|
-
<TestComponent />
|
|
106
|
-
</AnimationThemeProvider>
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
expect(screen.getByText('#updated-color')).toBeTruthy();
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
describe('useAnimationTheme', () => {
|
|
114
|
-
it('should return theme and setTheme', () => {
|
|
115
|
-
const TestComponent = () => {
|
|
116
|
-
const { theme, setTheme } = useAnimationTheme();
|
|
117
|
-
|
|
118
|
-
return (
|
|
119
|
-
<div>
|
|
120
|
-
<div testID="theme">{JSON.stringify(theme)}</div>
|
|
121
|
-
<div testID="set-theme">{typeof setTheme}</div>
|
|
122
|
-
</div>
|
|
123
|
-
);
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
render(
|
|
127
|
-
<AnimationThemeProvider>
|
|
128
|
-
<TestComponent />
|
|
129
|
-
</AnimationThemeProvider>
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
expect(screen.getByTestId('set-theme')).toHaveTextContent('function');
|
|
133
|
-
|
|
134
|
-
const themeElement = screen.getByTestId('theme');
|
|
135
|
-
const theme = JSON.parse(themeElement.props.children);
|
|
136
|
-
expect(theme).toHaveProperty('colors');
|
|
137
|
-
expect(theme).toHaveProperty('spacing');
|
|
138
|
-
expect(theme).toHaveProperty('borderRadius');
|
|
139
|
-
expect(theme).toHaveProperty('opacity');
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
it('should warn when used outside provider', () => {
|
|
143
|
-
const TestComponent = () => {
|
|
144
|
-
const { theme } = useAnimationTheme();
|
|
145
|
-
return <div>{theme.colors.primary}</div>;
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
render(<TestComponent />);
|
|
149
|
-
|
|
150
|
-
expect(console.warn).toHaveBeenCalledWith(
|
|
151
|
-
'useAnimationTheme must be used within AnimationThemeProvider'
|
|
152
|
-
);
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
it('should return default theme when used outside provider', () => {
|
|
156
|
-
const TestComponent = () => {
|
|
157
|
-
const { theme } = useAnimationTheme();
|
|
158
|
-
return <div>{theme.colors.primary}</div>;
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
render(<TestComponent />);
|
|
162
|
-
|
|
163
|
-
expect(screen.getByText(DEFAULT_ANIMATION_THEME.colors.primary)).toBeTruthy();
|
|
164
|
-
});
|
|
165
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Celebration Config Entity
|
|
3
|
-
* Single Responsibility: Define celebration configuration types
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export interface CelebrationAction {
|
|
7
|
-
label: string;
|
|
8
|
-
onPress: () => void;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface CelebrationConfig {
|
|
12
|
-
title: string;
|
|
13
|
-
message: string;
|
|
14
|
-
primaryAction?: CelebrationAction;
|
|
15
|
-
secondaryAction?: CelebrationAction;
|
|
16
|
-
}
|
|
17
|
-
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fireworks Config Entity
|
|
3
|
-
* Single Responsibility: Define fireworks configuration types and constants
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { FireworksConfig as AnimationFireworksConfig } from "../../../animation";
|
|
7
|
-
|
|
8
|
-
export interface ThemeColors {
|
|
9
|
-
primary?: string;
|
|
10
|
-
success?: string;
|
|
11
|
-
warning?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface CelebrationFireworksConfig extends Omit<AnimationFireworksConfig, 'colors'> {
|
|
15
|
-
colors: string[];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const DEFAULT_FIREWORKS_COLORS = [
|
|
19
|
-
"#FF6B6B",
|
|
20
|
-
"#4ECDC4",
|
|
21
|
-
"#FFE66D",
|
|
22
|
-
"#A8E6CF",
|
|
23
|
-
"#95E1D3",
|
|
24
|
-
"#F38181",
|
|
25
|
-
"#AA96DA",
|
|
26
|
-
] as const;
|
|
27
|
-
|
|
28
|
-
export const DEFAULT_FIREWORKS_CONFIG: Required<Pick<CelebrationFireworksConfig, "particleCount" | "duration">> = {
|
|
29
|
-
particleCount: 80,
|
|
30
|
-
duration: 2000,
|
|
31
|
-
} as const;
|
|
32
|
-
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @umituz/react-native-celebration - Public API
|
|
3
|
-
*
|
|
4
|
-
* Celebration animations and effects for React Native applications.
|
|
5
|
-
* Built on top of ../../../animation for consistent animations.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Celebration modals with fireworks
|
|
9
|
-
* - Configurable animations
|
|
10
|
-
* - Theme integration
|
|
11
|
-
* - State management
|
|
12
|
-
*
|
|
13
|
-
* Usage:
|
|
14
|
-
* ```typescript
|
|
15
|
-
* import { useCelebrationState, CelebrationModal, Animated } from '@umituz/react-native-celebration';
|
|
16
|
-
*
|
|
17
|
-
* const MyCelebration = () => {
|
|
18
|
-
* const { visible, show, hide, config } = useCelebrationState();
|
|
19
|
-
*
|
|
20
|
-
* return (
|
|
21
|
-
* <CelebrationModal
|
|
22
|
-
* visible={visible}
|
|
23
|
-
* config={config!}
|
|
24
|
-
* onClose={hide}
|
|
25
|
-
* themeColors={{ primary: '#007AFF', success: '#34C759' }}
|
|
26
|
-
* />
|
|
27
|
-
* );
|
|
28
|
-
* };
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// =============================================================================
|
|
35
|
-
// DOMAIN LAYER - Entities
|
|
36
|
-
// =============================================================================
|
|
37
|
-
|
|
38
|
-
export type {
|
|
39
|
-
CelebrationConfig,
|
|
40
|
-
CelebrationAction,
|
|
41
|
-
} from "./domain/entities/CelebrationConfig";
|
|
42
|
-
|
|
43
|
-
export type {
|
|
44
|
-
ThemeColors,
|
|
45
|
-
CelebrationFireworksConfig,
|
|
46
|
-
} from "./domain/entities/FireworksConfig";
|
|
47
|
-
|
|
48
|
-
export {
|
|
49
|
-
DEFAULT_FIREWORKS_COLORS,
|
|
50
|
-
DEFAULT_FIREWORKS_CONFIG,
|
|
51
|
-
} from "./domain/entities/FireworksConfig";
|
|
52
|
-
|
|
53
|
-
// =============================================================================
|
|
54
|
-
// INFRASTRUCTURE LAYER - Services
|
|
55
|
-
// =============================================================================
|
|
56
|
-
|
|
57
|
-
export { FireworksConfigService } from "./infrastructure/services/FireworksConfigService";
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// =============================================================================
|
|
62
|
-
// PRESENTATION LAYER - Hooks
|
|
63
|
-
// =============================================================================
|
|
64
|
-
|
|
65
|
-
export { useCelebrationState } from "./presentation/hooks/useCelebrationState";
|
|
66
|
-
export type { UseCelebrationStateReturn } from "./presentation/hooks/useCelebrationState";
|
|
67
|
-
|
|
68
|
-
export { useCelebrationModalAnimation } from "./presentation/hooks/useCelebrationModalAnimation";
|
|
69
|
-
export type { UseCelebrationModalAnimationReturn } from "./presentation/hooks/useCelebrationModalAnimation";
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
// =============================================================================
|
|
74
|
-
// PRESENTATION LAYER - Components
|
|
75
|
-
// =============================================================================
|
|
76
|
-
|
|
77
|
-
export { CelebrationModal } from "./presentation/components/CelebrationModal";
|
|
78
|
-
export type { CelebrationModalProps } from "./presentation/components/CelebrationModal";
|
|
79
|
-
|
|
80
|
-
export { CelebrationModalContent } from "./presentation/components/CelebrationModalContent";
|
|
81
|
-
export type { CelebrationModalContentProps } from "./presentation/components/CelebrationModalContent";
|
|
82
|
-
|
|
83
|
-
export { CelebrationFireworksOverlay } from "./presentation/components/CelebrationFireworksOverlay";
|
|
84
|
-
export type { CelebrationFireworksOverlayProps } from "./presentation/components/CelebrationFireworksOverlay";
|
|
85
|
-
|
|
86
|
-
// =============================================================================
|
|
87
|
-
// PRESENTATION LAYER - Styles
|
|
88
|
-
// =============================================================================
|
|
89
|
-
|
|
90
|
-
export { createCelebrationModalStyles } from "./presentation/styles/CelebrationModalStyles";
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fireworks Config Service
|
|
3
|
-
* Single Responsibility: Build fireworks configuration from theme colors
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type {
|
|
7
|
-
ThemeColors,
|
|
8
|
-
CelebrationFireworksConfig,
|
|
9
|
-
} from "../../domain/entities/FireworksConfig";
|
|
10
|
-
import {
|
|
11
|
-
DEFAULT_FIREWORKS_COLORS,
|
|
12
|
-
DEFAULT_FIREWORKS_CONFIG,
|
|
13
|
-
} from "../../domain/entities/FireworksConfig";
|
|
14
|
-
|
|
15
|
-
export class FireworksConfigService {
|
|
16
|
-
/**
|
|
17
|
-
* Build fireworks configuration with theme colors
|
|
18
|
-
* Gracefully handles missing theme colors
|
|
19
|
-
*/
|
|
20
|
-
static build(
|
|
21
|
-
themeColors?: ThemeColors,
|
|
22
|
-
customConfig?: Partial<CelebrationFireworksConfig>,
|
|
23
|
-
): CelebrationFireworksConfig {
|
|
24
|
-
const colors: string[] = [];
|
|
25
|
-
|
|
26
|
-
// Add theme colors if available
|
|
27
|
-
if (themeColors?.primary) {
|
|
28
|
-
colors.push(themeColors.primary);
|
|
29
|
-
}
|
|
30
|
-
if (themeColors?.success) {
|
|
31
|
-
colors.push(themeColors.success);
|
|
32
|
-
}
|
|
33
|
-
if (themeColors?.warning) {
|
|
34
|
-
colors.push(themeColors.warning);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Add default colors
|
|
38
|
-
colors.push(...DEFAULT_FIREWORKS_COLORS);
|
|
39
|
-
|
|
40
|
-
return {
|
|
41
|
-
particleCount: customConfig?.particleCount ?? DEFAULT_FIREWORKS_CONFIG.particleCount,
|
|
42
|
-
duration: customConfig?.duration ?? DEFAULT_FIREWORKS_CONFIG.duration,
|
|
43
|
-
colors: customConfig?.colors ?? colors,
|
|
44
|
-
particleSize: customConfig?.particleSize,
|
|
45
|
-
spread: customConfig?.spread,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Celebration Fireworks Overlay
|
|
3
|
-
* Renders fireworks effect as an overlay
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React from "react";
|
|
7
|
-
import { View, StyleSheet } from "react-native";
|
|
8
|
-
import { Fireworks } from "../../../animation";
|
|
9
|
-
import type { FireworksConfig } from "../../../animation";
|
|
10
|
-
|
|
11
|
-
export interface CelebrationFireworksOverlayProps {
|
|
12
|
-
visible: boolean;
|
|
13
|
-
config: FireworksConfig;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const CelebrationFireworksOverlay: React.FC<CelebrationFireworksOverlayProps> = ({
|
|
17
|
-
visible,
|
|
18
|
-
config,
|
|
19
|
-
}) => {
|
|
20
|
-
if (!visible) return null;
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<View style={StyleSheet.absoluteFill} pointerEvents="none">
|
|
24
|
-
<Fireworks
|
|
25
|
-
autoTrigger
|
|
26
|
-
triggerX={0.5}
|
|
27
|
-
triggerY={0.5}
|
|
28
|
-
{...config}
|
|
29
|
-
style={StyleSheet.absoluteFill}
|
|
30
|
-
/>
|
|
31
|
-
</View>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Celebration Modal Component
|
|
3
|
-
* Displays celebration modal with animations using BaseModal
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React from "react";
|
|
7
|
-
import { Animated } from "../../../animation";
|
|
8
|
-
import { BaseModal } from "../../../BaseModal";
|
|
9
|
-
import { useCelebrationModalAnimation } from "../hooks/useCelebrationModalAnimation";
|
|
10
|
-
import { FireworksConfigService } from "../../infrastructure/services/FireworksConfigService";
|
|
11
|
-
import { CelebrationModalContent } from "./CelebrationModalContent";
|
|
12
|
-
import { CelebrationFireworksOverlay } from "./CelebrationFireworksOverlay";
|
|
13
|
-
import type { CelebrationConfig } from "../../domain/entities/CelebrationConfig";
|
|
14
|
-
import type { ThemeColors } from "../../domain/entities/FireworksConfig";
|
|
15
|
-
import type {
|
|
16
|
-
ModalAnimationConfig,
|
|
17
|
-
IconAnimationConfig,
|
|
18
|
-
} from "../../../animation";
|
|
19
|
-
|
|
20
|
-
export interface CelebrationModalProps {
|
|
21
|
-
visible: boolean;
|
|
22
|
-
config: CelebrationConfig;
|
|
23
|
-
onClose: () => void;
|
|
24
|
-
themeColors?: ThemeColors;
|
|
25
|
-
fireworksConfig?: Partial<import("../../../animation").FireworksConfig>;
|
|
26
|
-
animationConfig?: {
|
|
27
|
-
modal?: ModalAnimationConfig;
|
|
28
|
-
icon?: IconAnimationConfig;
|
|
29
|
-
};
|
|
30
|
-
renderContent?: (props: {
|
|
31
|
-
config: CelebrationConfig;
|
|
32
|
-
onClose: () => void;
|
|
33
|
-
iconStyle: ReturnType<typeof useCelebrationModalAnimation>["iconStyle"];
|
|
34
|
-
modalStyle: ReturnType<typeof useCelebrationModalAnimation>["modalStyle"];
|
|
35
|
-
}) => React.ReactNode;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Access View through Animated namespace with type assertion for reanimated v3 compatibility
|
|
39
|
-
const AnimatedView = (Animated as unknown as { View: React.ComponentType<{ style?: unknown; children?: React.ReactNode }> }).View;
|
|
40
|
-
|
|
41
|
-
export const CelebrationModal: React.FC<CelebrationModalProps> = ({
|
|
42
|
-
visible,
|
|
43
|
-
config,
|
|
44
|
-
onClose,
|
|
45
|
-
themeColors,
|
|
46
|
-
fireworksConfig,
|
|
47
|
-
animationConfig,
|
|
48
|
-
renderContent,
|
|
49
|
-
}) => {
|
|
50
|
-
const { isReady, iconStyle, modalStyle } =
|
|
51
|
-
useCelebrationModalAnimation(visible, animationConfig);
|
|
52
|
-
|
|
53
|
-
const fireworks = FireworksConfigService.build(themeColors, fireworksConfig);
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<>
|
|
57
|
-
<CelebrationFireworksOverlay visible={visible} config={fireworks} />
|
|
58
|
-
|
|
59
|
-
<BaseModal
|
|
60
|
-
visible={visible && isReady}
|
|
61
|
-
onClose={onClose}
|
|
62
|
-
dismissOnBackdrop={true}
|
|
63
|
-
testID="celebration-modal"
|
|
64
|
-
>
|
|
65
|
-
<AnimatedView style={modalStyle}>
|
|
66
|
-
{renderContent ? (
|
|
67
|
-
renderContent({ config, onClose, iconStyle, modalStyle })
|
|
68
|
-
) : themeColors ? (
|
|
69
|
-
<CelebrationModalContent
|
|
70
|
-
config={config}
|
|
71
|
-
onClose={onClose}
|
|
72
|
-
themeColors={themeColors}
|
|
73
|
-
iconStyle={iconStyle}
|
|
74
|
-
modalStyle={modalStyle}
|
|
75
|
-
/>
|
|
76
|
-
) : null}
|
|
77
|
-
</AnimatedView>
|
|
78
|
-
</BaseModal>
|
|
79
|
-
</>
|
|
80
|
-
);
|
|
81
|
-
};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
|
-
import { Animated } from "../../../animation";
|
|
4
|
-
import { useAppDesignTokens } from "../../../../theme";
|
|
5
|
-
import { AtomicButton, AtomicText, AtomicIcon } from "../../../../atoms";
|
|
6
|
-
import type { CelebrationConfig } from "../../domain/entities/CelebrationConfig";
|
|
7
|
-
import type { ThemeColors } from "../../domain/entities/FireworksConfig";
|
|
8
|
-
import type { useCelebrationModalAnimation } from "../hooks/useCelebrationModalAnimation";
|
|
9
|
-
import { createCelebrationModalStyles } from "../styles/CelebrationModalStyles";
|
|
10
|
-
|
|
11
|
-
// Access View through Animated namespace with type assertion for reanimated v3 compatibility
|
|
12
|
-
const AnimatedView = (Animated as unknown as { View: React.ComponentType<{ style?: unknown; children?: React.ReactNode }> }).View;
|
|
13
|
-
|
|
14
|
-
export interface CelebrationModalContentProps {
|
|
15
|
-
config: CelebrationConfig;
|
|
16
|
-
onClose: () => void;
|
|
17
|
-
themeColors?: ThemeColors;
|
|
18
|
-
iconStyle: ReturnType<typeof useCelebrationModalAnimation>["iconStyle"];
|
|
19
|
-
modalStyle: ReturnType<typeof useCelebrationModalAnimation>["modalStyle"];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const CelebrationModalContent: React.FC<CelebrationModalContentProps> = ({
|
|
23
|
-
config,
|
|
24
|
-
onClose,
|
|
25
|
-
themeColors,
|
|
26
|
-
iconStyle,
|
|
27
|
-
modalStyle,
|
|
28
|
-
}) => {
|
|
29
|
-
const tokens = useAppDesignTokens();
|
|
30
|
-
const styles = createCelebrationModalStyles();
|
|
31
|
-
|
|
32
|
-
const successColor = themeColors?.success || tokens.colors.success;
|
|
33
|
-
const primaryColor = themeColors?.primary || tokens.colors.primary;
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<AnimatedView
|
|
37
|
-
style={[
|
|
38
|
-
styles.modal,
|
|
39
|
-
modalStyle,
|
|
40
|
-
{
|
|
41
|
-
backgroundColor: tokens.colors.surface,
|
|
42
|
-
borderColor: tokens.colors.surfaceVariant,
|
|
43
|
-
},
|
|
44
|
-
]}
|
|
45
|
-
>
|
|
46
|
-
<AnimatedView style={[styles.iconContainer, iconStyle]}>
|
|
47
|
-
<View style={[styles.iconCircle, { backgroundColor: successColor }]}>
|
|
48
|
-
<AtomicIcon name="checkmark" size="xl" color="onPrimary" />
|
|
49
|
-
</View>
|
|
50
|
-
</AnimatedView>
|
|
51
|
-
|
|
52
|
-
<AtomicText type="headlineSmall" style={[styles.title, { color: tokens.colors.onSurface }]}>
|
|
53
|
-
{config.title}
|
|
54
|
-
</AtomicText>
|
|
55
|
-
|
|
56
|
-
<AtomicText type="bodyLarge" style={[styles.message, { color: tokens.colors.onSurface }]}>
|
|
57
|
-
{config.message}
|
|
58
|
-
</AtomicText>
|
|
59
|
-
|
|
60
|
-
<View style={styles.actions}>
|
|
61
|
-
{config.primaryAction && (
|
|
62
|
-
<AtomicButton
|
|
63
|
-
title={config.primaryAction.label}
|
|
64
|
-
onPress={() => {
|
|
65
|
-
config.primaryAction?.onPress();
|
|
66
|
-
onClose();
|
|
67
|
-
}}
|
|
68
|
-
variant="primary"
|
|
69
|
-
style={{ backgroundColor: primaryColor }}
|
|
70
|
-
fullWidth
|
|
71
|
-
/>
|
|
72
|
-
)}
|
|
73
|
-
|
|
74
|
-
{config.secondaryAction && (
|
|
75
|
-
<AtomicButton
|
|
76
|
-
title={config.secondaryAction.label}
|
|
77
|
-
onPress={() => {
|
|
78
|
-
config.secondaryAction?.onPress();
|
|
79
|
-
onClose();
|
|
80
|
-
}}
|
|
81
|
-
variant="secondary"
|
|
82
|
-
fullWidth
|
|
83
|
-
/>
|
|
84
|
-
)}
|
|
85
|
-
</View>
|
|
86
|
-
</AnimatedView>
|
|
87
|
-
);
|
|
88
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useCelebrationModalAnimation Hook
|
|
3
|
-
* Single Responsibility: Compose all celebration modal animations
|
|
4
|
-
* Uses ../../../animation directly
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
useModalAnimations,
|
|
9
|
-
useIconAnimations,
|
|
10
|
-
type ModalAnimationConfig,
|
|
11
|
-
type IconAnimationConfig,
|
|
12
|
-
} from "../../../animation";
|
|
13
|
-
|
|
14
|
-
export interface UseCelebrationModalAnimationReturn {
|
|
15
|
-
isReady: boolean;
|
|
16
|
-
overlayStyle: ReturnType<typeof useModalAnimations>["overlayStyle"];
|
|
17
|
-
modalStyle: ReturnType<typeof useModalAnimations>["modalStyle"];
|
|
18
|
-
iconStyle: ReturnType<typeof useIconAnimations>["iconStyle"];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Hook for managing all celebration modal animations
|
|
23
|
-
*/
|
|
24
|
-
export function useCelebrationModalAnimation(
|
|
25
|
-
visible: boolean,
|
|
26
|
-
animationConfig?: {
|
|
27
|
-
modal?: ModalAnimationConfig;
|
|
28
|
-
icon?: IconAnimationConfig;
|
|
29
|
-
},
|
|
30
|
-
): UseCelebrationModalAnimationReturn {
|
|
31
|
-
const { isReady, overlayStyle, modalStyle } = useModalAnimations(
|
|
32
|
-
visible,
|
|
33
|
-
animationConfig?.modal,
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const { iconStyle } = useIconAnimations(
|
|
37
|
-
visible,
|
|
38
|
-
isReady,
|
|
39
|
-
animationConfig?.icon,
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
isReady,
|
|
44
|
-
overlayStyle,
|
|
45
|
-
modalStyle,
|
|
46
|
-
iconStyle,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useCelebrationState Hook
|
|
3
|
-
* Single Responsibility: Manage celebration modal state
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { useState, useCallback } from "react";
|
|
7
|
-
import type { CelebrationConfig } from "../../domain/entities/CelebrationConfig";
|
|
8
|
-
|
|
9
|
-
export interface UseCelebrationStateReturn {
|
|
10
|
-
visible: boolean;
|
|
11
|
-
config: CelebrationConfig | null;
|
|
12
|
-
show: (config: CelebrationConfig) => void;
|
|
13
|
-
hide: () => void;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const ANIMATION_CLEANUP_DELAY = 300;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Hook for managing celebration modal state
|
|
20
|
-
*/
|
|
21
|
-
export function useCelebrationState(): UseCelebrationStateReturn {
|
|
22
|
-
const [visible, setVisible] = useState(false);
|
|
23
|
-
const [config, setConfig] = useState<CelebrationConfig | null>(null);
|
|
24
|
-
|
|
25
|
-
const show = useCallback((celebrationConfig: CelebrationConfig) => {
|
|
26
|
-
setConfig(celebrationConfig);
|
|
27
|
-
setVisible(true);
|
|
28
|
-
}, []);
|
|
29
|
-
|
|
30
|
-
const hide = useCallback(() => {
|
|
31
|
-
setVisible(false);
|
|
32
|
-
// Clear config after animation completes
|
|
33
|
-
setTimeout(() => {
|
|
34
|
-
setConfig(null);
|
|
35
|
-
}, ANIMATION_CLEANUP_DELAY);
|
|
36
|
-
}, []);
|
|
37
|
-
|
|
38
|
-
return {
|
|
39
|
-
visible,
|
|
40
|
-
config: config || null,
|
|
41
|
-
show,
|
|
42
|
-
hide,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|