react-awesome-reveal 4.0.1 → 4.2.0

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 CHANGED
@@ -7,7 +7,7 @@
7
7
  [![License](https://badgen.net/npm/license/react-awesome-reveal)](https://www.npmjs.com/package/react-awesome-reveal/v/latest)
8
8
  [![Rate on Openbase](https://badges.openbase.io/js/rating/react-awesome-reveal.svg)](https://openbase.io/js/react-awesome-reveal?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge)
9
9
 
10
- [React Awesome Reveal](https://github.com/morellodev/react-awesome-reveal) is a library for React apps written in TypeScript that adds reveal animations using the Intersection Observer API to detect when the elements appear in the viewport. Animations are internally provided by [Emotion](https://emotion.sh) and implemented as CSS Animations to benefit from hardware acceleration.
10
+ [React Awesome Reveal](https://react-awesome-reveal.morello.dev) is a library for React apps written in TypeScript that adds reveal animations using the Intersection Observer API to detect when the elements appear in the viewport. Animations are internally provided by [Emotion](https://emotion.sh) and implemented as CSS Animations to benefit from hardware acceleration.
11
11
 
12
12
  ## Table Of Contents
13
13
 
@@ -45,12 +45,18 @@ To add this package as a dependency to your app, simply run
45
45
  npm install react-awesome-reveal @emotion/react --save
46
46
  ```
47
47
 
48
- or, if you are using Yarn (as I strongly suggest):
48
+ or, if you are using Yarn:
49
49
 
50
50
  ```sh
51
51
  yarn add react-awesome-reveal @emotion/react
52
52
  ```
53
53
 
54
+ or, if you are using PNPM (as I strongly suggest):
55
+
56
+ ```sh
57
+ pnpm add react-awesome-reveal @emotion/react
58
+ ```
59
+
54
60
  ## Quick Start
55
61
 
56
62
  Import effects from [React Awesome Reveal](https://www.npmjs.com/package/react-awesome-reveal) to your React component, for example the `Fade` effect:
@@ -118,22 +124,16 @@ To chain together multiple animations, set the `cascade` prop to `true`:
118
124
  </Fade>
119
125
  ```
120
126
 
121
- This is _almost_ equivalent to
127
+ Play with the `damping` prop to alter the delay by which each child will progressively appear:
122
128
 
123
- ```jsx
124
- <Fade>
129
+ ```tsx
130
+ <Fade cascade damping={0.1}>
125
131
  <p>I enter first...</p>
126
- </Fade>
127
- <Fade delay={1000}>
128
132
  <p>...then comes my turn...</p>
129
- </Fade>
130
- <Fade delay={2000}>
131
133
  <p>...and finally you see me!</p>
132
134
  </Fade>
133
135
  ```
134
136
 
135
- with the exception that, since each `Fade` component creates an isolated visibility context, in the second snippet every `p` will be shown only if they are inside the viewport (after the specified delay).
136
-
137
137
  ## Custom Animations
138
138
 
139
139
  Starting from version 3.2.0, you can define custom animations! Simply import the `Reveal` component (which is the default export of the library – give it the name you want) and pass it a `keyframes` prop:
@@ -155,12 +155,8 @@ const customAnimation = keyframes`
155
155
  }
156
156
  `;
157
157
 
158
- function MyAnimatedComponent({ children }) {
159
- return (
160
- <Reveal keyframes={customAnimation}>
161
- {children}
162
- </Reveal>;
163
- );
158
+ function CustomAnimation({ children }) {
159
+ return <Reveal keyframes={customAnimation}>{children}</Reveal>;
164
160
  }
165
161
  ```
166
162
 
@@ -1,6 +1,6 @@
1
- import { Interpolation, Theme } from "@emotion/react";
2
- import { Keyframes } from "@emotion/serialize";
3
- export interface RevealProps {
1
+ import { Keyframes } from '@emotion/serialize';
2
+
3
+ interface RevealProps {
4
4
  /**
5
5
  * Stagger its children animations.
6
6
  * @default false
@@ -35,10 +35,6 @@ export interface RevealProps {
35
35
  * @default false
36
36
  */
37
37
  triggerOnce?: boolean;
38
- /**
39
- * Custom Emotion styles.
40
- */
41
- css?: Interpolation<Theme>;
42
38
  /**
43
39
  * Class names to add to the container element.
44
40
  */
@@ -70,18 +66,20 @@ export interface RevealProps {
70
66
  */
71
67
  onVisibilityChange?(inView: boolean, entry: IntersectionObserverEntry): void;
72
68
  }
73
- export const Reveal: React.FC<RevealProps>;
69
+ declare const Reveal: React.FC<RevealProps>;
70
+
74
71
  type AttentionSeekerEffect = "bounce" | "flash" | "headShake" | "heartBeat" | "jello" | "pulse" | "rubberBand" | "shake" | "shakeX" | "shakeY" | "swing" | "tada" | "wobble";
75
- export interface AttentionSeekerProps extends Omit<RevealProps, "keyframes" | "css"> {
72
+ interface AttentionSeekerProps extends Omit<RevealProps, "keyframes"> {
76
73
  /**
77
74
  * The animation effect to use for this attention seeker.
78
75
  * @default "bounce"
79
76
  */
80
77
  effect?: AttentionSeekerEffect;
81
78
  }
82
- export const AttentionSeeker: React.FC<AttentionSeekerProps>;
79
+ declare const AttentionSeeker: React.FC<AttentionSeekerProps>;
80
+
83
81
  type BounceDirection = "down" | "left" | "right" | "up";
84
- export interface BounceProps extends Omit<RevealProps, "keyframes" | "css"> {
82
+ interface BounceProps extends Omit<RevealProps, "keyframes"> {
85
83
  /**
86
84
  * Origin of the animation.
87
85
  * @default undefined
@@ -93,9 +91,10 @@ export interface BounceProps extends Omit<RevealProps, "keyframes" | "css"> {
93
91
  */
94
92
  reverse?: boolean;
95
93
  }
96
- export const Bounce: React.FC<BounceProps>;
94
+ declare const Bounce: React.FC<BounceProps>;
95
+
97
96
  type FadeDirection = "bottom-left" | "bottom-right" | "down" | "left" | "right" | "top-left" | "top-right" | "up";
98
- export interface FadeProps extends Omit<RevealProps, "keyframes" | "css"> {
97
+ interface FadeProps extends Omit<RevealProps, "keyframes"> {
99
98
  /**
100
99
  * Causes the animation to start farther. Only works with "down", "left", "right" and "up" directions.
101
100
  * @default false
@@ -112,9 +111,10 @@ export interface FadeProps extends Omit<RevealProps, "keyframes" | "css"> {
112
111
  */
113
112
  reverse?: boolean;
114
113
  }
115
- export const Fade: React.FC<FadeProps>;
114
+ declare const Fade: React.FC<FadeProps>;
115
+
116
116
  type FlipDirection = "horizontal" | "vertical";
117
- export interface FlipProps extends Omit<RevealProps, "keyframes" | "css"> {
117
+ interface FlipProps extends Omit<RevealProps, "keyframes"> {
118
118
  /**
119
119
  * Axis direction of the animation.
120
120
  * @default undefined
@@ -126,21 +126,25 @@ export interface FlipProps extends Omit<RevealProps, "keyframes" | "css"> {
126
126
  */
127
127
  reverse?: boolean;
128
128
  }
129
- export const Flip: React.FC<FlipProps>;
130
- export type HingeProps = Omit<RevealProps, "keyframes" | "css">;
131
- export const Hinge: React.FC<HingeProps>;
132
- export type JackInTheBoxProps = Omit<RevealProps, "keyframes" | "css">;
133
- export const JackInTheBox: React.FC<JackInTheBoxProps>;
134
- export interface RollProps extends Omit<RevealProps, "keyframes" | "css"> {
129
+ declare const Flip: React.FC<FlipProps>;
130
+
131
+ type HingeProps = Omit<RevealProps, "keyframes">;
132
+ declare const Hinge: React.FC<HingeProps>;
133
+
134
+ type JackInTheBoxProps = Omit<RevealProps, "keyframes">;
135
+ declare const JackInTheBox: React.FC<JackInTheBoxProps>;
136
+
137
+ interface RollProps extends Omit<RevealProps, "keyframes"> {
135
138
  /**
136
139
  * Specifies if the animation should make element(s) disappear.
137
140
  * @default false
138
141
  */
139
142
  reverse?: boolean;
140
143
  }
141
- export const Roll: React.FC<RollProps>;
144
+ declare const Roll: React.FC<RollProps>;
145
+
142
146
  type RotateDirection = "bottom-left" | "bottom-right" | "top-left" | "top-right";
143
- export interface RotateProps extends Omit<RevealProps, "keyframes" | "css"> {
147
+ interface RotateProps extends Omit<RevealProps, "keyframes"> {
144
148
  /**
145
149
  * Origin of the animation.
146
150
  * @default undefined
@@ -152,9 +156,10 @@ export interface RotateProps extends Omit<RevealProps, "keyframes" | "css"> {
152
156
  */
153
157
  reverse?: boolean;
154
158
  }
155
- export const Rotate: React.FC<RotateProps>;
159
+ declare const Rotate: React.FC<RotateProps>;
160
+
156
161
  type SlideDirection = "down" | "left" | "right" | "up";
157
- export interface SlideProps extends Omit<RevealProps, "keyframes" | "css"> {
162
+ interface SlideProps extends Omit<RevealProps, "keyframes"> {
158
163
  /**
159
164
  * Origin of the animation.
160
165
  * @default undefined
@@ -166,9 +171,10 @@ export interface SlideProps extends Omit<RevealProps, "keyframes" | "css"> {
166
171
  */
167
172
  reverse?: boolean;
168
173
  }
169
- export const Slide: React.FC<SlideProps>;
174
+ declare const Slide: React.FC<SlideProps>;
175
+
170
176
  type ZoomDirection = "down" | "left" | "right" | "up";
171
- export interface ZoomProps extends Omit<RevealProps, "keyframes" | "css"> {
177
+ interface ZoomProps extends Omit<RevealProps, "keyframes"> {
172
178
  /**
173
179
  * Origin of the animation.
174
180
  * @default undefined
@@ -180,6 +186,6 @@ export interface ZoomProps extends Omit<RevealProps, "keyframes" | "css"> {
180
186
  */
181
187
  reverse?: boolean;
182
188
  }
183
- export const Zoom: React.FC<ZoomProps>;
189
+ declare const Zoom: React.FC<ZoomProps>;
184
190
 
185
- //# sourceMappingURL=types.d.ts.map
191
+ export { AttentionSeeker, AttentionSeekerProps, Bounce, BounceProps, Fade, FadeProps, Flip, FlipProps, Hinge, HingeProps, JackInTheBox, JackInTheBoxProps, Reveal, RevealProps, Roll, RollProps, Rotate, RotateProps, Slide, SlideProps, Zoom, ZoomProps, Reveal as default };