@hoddy-ui/core 1.1.4 → 2.0.35
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 +155 -28
- package/next/dist/index.d.mts +113 -41
- package/next/dist/index.d.ts +113 -41
- package/next/dist/index.js +444 -297
- package/next/dist/index.js.map +1 -1
- package/next/dist/index.mjs +460 -307
- package/next/dist/index.mjs.map +1 -1
- package/next/package.json +7 -6
- package/package.json +7 -5
- package/src/Components/AlertX.tsx +4 -4
- package/src/Components/Animators/Animator.tsx +1 -1
- package/src/Components/Animators/hooks/useAppState.ts +4 -11
- package/src/Components/Animators/hooks/useBlinkAnimation.ts +31 -24
- package/src/Components/Animators/hooks/useFadeAnimation.ts +28 -26
- package/src/Components/Animators/hooks/useFloatAnimation.ts +67 -57
- package/src/Components/Animators/hooks/useGrowAnimation.ts +41 -28
- package/src/Components/Animators/hooks/useRollAnimation.ts +77 -57
- package/src/Components/Animators/hooks/useSlideAnimation.ts +44 -35
- package/src/Components/Animators/hooks/useThrownUpAnimation.ts +43 -50
- package/src/Components/Avatar.tsx +13 -7
- package/src/Components/Button.tsx +13 -12
- package/src/Components/FlashMessage.tsx +119 -42
- package/src/Components/FormWrapper.tsx +7 -2
- package/src/Components/Grid.tsx +5 -5
- package/src/Components/Locator.tsx +10 -2
- package/src/Components/OTPInput.tsx +0 -4
- package/src/Components/Popup.tsx +161 -83
- package/src/Components/SafeAreaView.tsx +11 -11
- package/src/Components/SelectMenu.tsx +34 -52
- package/src/Components/TextField.tsx +16 -6
- package/src/Components/Typography.tsx +19 -16
- package/src/config/KeyManager.ts +6 -1
- package/src/config/index.ts +37 -2
- package/src/hooks.ts +21 -14
- package/src/theme/index.tsx +14 -6
- package/src/types.ts +12 -3
- package/src/utility.ts +11 -0
- package/src/Components/Animators/README.md +0 -137
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
# Unified Animator Component
|
|
2
|
-
|
|
3
|
-
The `Animator` component provides a single interface for all animation types with generic props.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- **Single Component**: One component handles all animation types
|
|
8
|
-
- **Generic Props**: Consistent prop naming across all animations (e.g., `closeAfter` instead of animation-specific names)
|
|
9
|
-
- **Modular Hooks**: Animation logic is separated into individual custom hooks
|
|
10
|
-
- **Type Safety**: Full TypeScript support with proper typing
|
|
11
|
-
- **Performance**: Only the specified animation runs, others are not loaded
|
|
12
|
-
|
|
13
|
-
## Basic Usage
|
|
14
|
-
|
|
15
|
-
```tsx
|
|
16
|
-
import { Animator } from 'hoddy-ui';
|
|
17
|
-
|
|
18
|
-
// Fade animation
|
|
19
|
-
<Animator type="fade" duration={1000} closeAfter={3000}>
|
|
20
|
-
<Text>This will fade in and out</Text>
|
|
21
|
-
</Animator>
|
|
22
|
-
|
|
23
|
-
// Slide animation
|
|
24
|
-
<Animator type="slide" direction="up" duration={800} closeAfter={2000}>
|
|
25
|
-
<View>This will slide up from bottom</View>
|
|
26
|
-
</Animator>
|
|
27
|
-
|
|
28
|
-
// Grow animation
|
|
29
|
-
<Animator type="grow" initialScale={0.5} duration={600}>
|
|
30
|
-
<Button>This will grow from 50% scale</Button>
|
|
31
|
-
</Animator>
|
|
32
|
-
|
|
33
|
-
// Blink animation (continuous)
|
|
34
|
-
<Animator type="blink" blinkDuration={1000} minOpacity={0.3}>
|
|
35
|
-
<Icon>This will blink continuously</Icon>
|
|
36
|
-
</Animator>
|
|
37
|
-
|
|
38
|
-
// Float animation
|
|
39
|
-
<Animator type="float" floatDistance={20} floatDuration={2000} closeAfter={5000}>
|
|
40
|
-
<View>This will float up and down</View>
|
|
41
|
-
</Animator>
|
|
42
|
-
|
|
43
|
-
// Roll animation
|
|
44
|
-
<Animator type="roll" initialRotate="45deg" duration={800}>
|
|
45
|
-
<Image>This will roll and rotate</Image>
|
|
46
|
-
</Animator>
|
|
47
|
-
|
|
48
|
-
// Thrown up animation
|
|
49
|
-
<Animator type="thrownup" delay={500} closeAfter={4000}>
|
|
50
|
-
<Notification>This will spring up from bottom</Notification>
|
|
51
|
-
</Animator>
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Generic Props
|
|
55
|
-
|
|
56
|
-
All animation types support these generic props:
|
|
57
|
-
|
|
58
|
-
- `type`: Animation type ("fade" | "grow" | "slide" | "blink" | "float" | "roll" | "thrownup")
|
|
59
|
-
- `duration`: Animation duration in milliseconds
|
|
60
|
-
- `delay`: Delay before animation starts
|
|
61
|
-
- `closeAfter`: Time after which the exit animation starts (null for no exit)
|
|
62
|
-
- `style`: Additional styles for the animated view
|
|
63
|
-
|
|
64
|
-
## Animation-Specific Props
|
|
65
|
-
|
|
66
|
-
### Slide Animation
|
|
67
|
-
|
|
68
|
-
- `direction`: "up" | "down" | "left" | "right"
|
|
69
|
-
- `initialValue`: Custom initial position value
|
|
70
|
-
|
|
71
|
-
### Grow Animation
|
|
72
|
-
|
|
73
|
-
- `initialScale`: Starting scale (default: 0)
|
|
74
|
-
|
|
75
|
-
### Blink Animation
|
|
76
|
-
|
|
77
|
-
- `blinkDuration`: Duration of one blink cycle
|
|
78
|
-
- `minOpacity`: Minimum opacity value
|
|
79
|
-
- `maxOpacity`: Maximum opacity value
|
|
80
|
-
|
|
81
|
-
### Float Animation
|
|
82
|
-
|
|
83
|
-
- `closeDuration`: Duration of exit animation
|
|
84
|
-
- `floatDistance`: Distance to float up/down
|
|
85
|
-
- `floatDuration`: Duration of one float cycle
|
|
86
|
-
|
|
87
|
-
### Roll Animation
|
|
88
|
-
|
|
89
|
-
- `initialTranslateY`: Initial vertical position
|
|
90
|
-
- `initialRotate`: Initial rotation value
|
|
91
|
-
|
|
92
|
-
## Custom Hooks
|
|
93
|
-
|
|
94
|
-
You can also use the animation hooks directly:
|
|
95
|
-
|
|
96
|
-
```tsx
|
|
97
|
-
import { useFadeAnimation, useSlideAnimation } from "hoddy-ui";
|
|
98
|
-
|
|
99
|
-
const MyComponent = () => {
|
|
100
|
-
const { animatedStyle } = useFadeAnimation({
|
|
101
|
-
duration: 800,
|
|
102
|
-
closeAfter: 2000,
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
return (
|
|
106
|
-
<Animated.View style={animatedStyle}>
|
|
107
|
-
<Text>Custom animated content</Text>
|
|
108
|
-
</Animated.View>
|
|
109
|
-
);
|
|
110
|
-
};
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
## Migration from Old Components
|
|
114
|
-
|
|
115
|
-
Replace old individual animation components:
|
|
116
|
-
|
|
117
|
-
```tsx
|
|
118
|
-
// Old way
|
|
119
|
-
<AnimatedFade fadeOutAfter={2000}>
|
|
120
|
-
<Text>Content</Text>
|
|
121
|
-
</AnimatedFade>
|
|
122
|
-
|
|
123
|
-
// New way
|
|
124
|
-
<Animator type="fade" closeAfter={2000}>
|
|
125
|
-
<Text>Content</Text>
|
|
126
|
-
</Animator>
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
## Available Animation Types
|
|
130
|
-
|
|
131
|
-
1. **fade**: Simple fade in/out
|
|
132
|
-
2. **grow**: Scale-based growth animation
|
|
133
|
-
3. **slide**: Directional slide animations
|
|
134
|
-
4. **blink**: Continuous opacity blinking
|
|
135
|
-
5. **float**: Floating up/down motion with fade
|
|
136
|
-
6. **roll**: Combined rotation and translation
|
|
137
|
-
7. **thrownup**: Spring-based upward animation
|