├── .babelrc
├── .circleci
└── config.yml
├── .editorconfig
├── .gitattributes
├── .gitignore
├── .nvrmrc
├── README.md
├── animate
└── style.css
├── docs
├── App.js
├── assets
│ ├── fonts
│ │ └── Lazer84.woff2
│ ├── images
│ │ └── driver.jpg
│ ├── select.css
│ └── styles.css
├── bundle.js
├── index.html
├── package.json
└── webpack.config.babel.js
├── package.json
├── react-motions
├── index.js
├── package.json
├── react-motions.min.js
├── src
│ ├── bounce
│ │ ├── __tests__
│ │ │ ├── __snapshots__
│ │ │ │ ├── bounce-test.js.snap
│ │ │ │ └── withBounce-test.js.snap
│ │ │ ├── bounce-test.js
│ │ │ └── withBounce-test.js
│ │ ├── bounce.css
│ │ ├── bounce.js
│ │ ├── index.js
│ │ ├── styles.js
│ │ └── withBounce.js
│ ├── fadeIn
│ │ ├── __tests__
│ │ │ ├── __snapshots__
│ │ │ │ ├── fadeIn-test.js.snap
│ │ │ │ └── withFadeIn-test.js.snap
│ │ │ ├── fadeIn-test.js
│ │ │ └── withFadeIn-test.js
│ │ ├── fadeIn.css
│ │ ├── fadeIn.js
│ │ ├── index.js
│ │ ├── styles.js
│ │ └── withFadeIn.js
│ ├── fadeOut
│ │ ├── __tests__
│ │ │ ├── __snapshots__
│ │ │ │ ├── fadeOut-test.js.snap
│ │ │ │ └── withFadeOut-test.js.snap
│ │ │ ├── fadeOut-test.js
│ │ │ └── withFadeOut-test.js
│ │ ├── fadeOut.css
│ │ ├── fadeOut.js
│ │ ├── index.js
│ │ ├── styles.js
│ │ └── withFadeOut.js
│ ├── flash
│ │ ├── __tests__
│ │ │ ├── __snapshots__
│ │ │ │ ├── flash-test.js.snap
│ │ │ │ └── withFlash-test.js.snap
│ │ │ ├── flash-test.js
│ │ │ └── withFlash-test.js
│ │ ├── flash.css
│ │ ├── flash.js
│ │ ├── index.js
│ │ ├── styles.js
│ │ └── withFlash.js
│ ├── injectStyles.js
│ ├── jello
│ │ ├── __tests__
│ │ │ ├── __snapshots__
│ │ │ │ ├── jello-test.js.snap
│ │ │ │ └── withJello-test.js.snap
│ │ │ ├── jello-test.js
│ │ │ └── withJello-test.js
│ │ ├── index.js
│ │ ├── jello.css
│ │ ├── jello.js
│ │ ├── styles.js
│ │ └── withJello.js
│ ├── pulse
│ │ ├── __tests__
│ │ │ ├── __snapshots__
│ │ │ │ ├── pulse-test.js.snap
│ │ │ │ └── withPulse-test.js.snap
│ │ │ ├── pulse-test.js
│ │ │ └── withPulse-test.js
│ │ ├── index.js
│ │ ├── pulse.css
│ │ ├── pulse.js
│ │ ├── styles.js
│ │ └── withPulse.js
│ ├── rubberBand
│ │ ├── __tests__
│ │ │ ├── __snapshots__
│ │ │ │ ├── rubberBand-test.js.snap
│ │ │ │ └── withRubberBand-test.js.snap
│ │ │ ├── rubberBand-test.js
│ │ │ └── withRubberBand-test.js
│ │ ├── index.js
│ │ ├── rubberBand.css
│ │ ├── rubberBand.js
│ │ ├── styles.js
│ │ └── withRubberBand.js
│ ├── shake
│ │ ├── __tests__
│ │ │ ├── __snapshots__
│ │ │ │ ├── shake-test.js.snap
│ │ │ │ └── withShake-test.js.snap
│ │ │ ├── shake-test.js
│ │ │ └── withShake-test.js
│ │ ├── index.js
│ │ ├── shake.css
│ │ ├── shake.js
│ │ ├── styles.js
│ │ └── withShake.js
│ ├── swing
│ │ ├── __tests__
│ │ │ ├── __snapshots__
│ │ │ │ ├── swing-test.js.snap
│ │ │ │ └── withSwing-test.js.snap
│ │ │ ├── swing-test.js
│ │ │ └── withSwing-test.js
│ │ ├── index.js
│ │ ├── styles.js
│ │ ├── swing.css
│ │ ├── swing.js
│ │ └── withSwing.js
│ ├── tada
│ │ ├── __tests__
│ │ │ ├── __snapshots__
│ │ │ │ ├── tada-test.js.snap
│ │ │ │ └── withTada-test.js.snap
│ │ │ ├── tada-test.js
│ │ │ └── withTada-test.js
│ │ ├── index.js
│ │ ├── styles.js
│ │ ├── tada.css
│ │ ├── tada.js
│ │ └── withTada.js
│ ├── withInfinite.js
│ └── wobble
│ │ ├── __tests__
│ │ ├── __snapshots__
│ │ │ ├── withWobble-test.js.snap
│ │ │ └── wobble-test.js.snap
│ │ ├── withWobble-test.js
│ │ └── wobble-test.js
│ │ ├── index.js
│ │ ├── styles.js
│ │ ├── withWobble.js
│ │ ├── wobble.css
│ │ └── wobble.js
└── webpack.config.babel.js
├── test
└── setup.js
└── yarn.lock
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets":[
3 | "env", "react"
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/.circleci/config.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | jobs:
3 | build:
4 | docker:
5 | - image: circleci/node:8
6 |
7 | working_directory: ~/repo
8 |
9 | steps:
10 | - checkout
11 |
12 | # Versions Check
13 | - run:
14 | name: Node version
15 | command: node -v
16 | - run:
17 | name: Yarn version
18 | command: yarn --version
19 |
20 | - restore_cache:
21 | keys:
22 | - v1-dependencies-{{ checksum "package.json" }}
23 | - v1-dependencies-
24 |
25 | - run:
26 | name: Install base packages
27 | command: yarn install
28 |
29 | - save_cache:
30 | paths:
31 | - node_modules
32 | key: v1-dependencies-{{ checksum "package.json" }}
33 |
34 | - run:
35 | name: Lint and Test packages
36 | command: yarn test
37 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # http://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | end_of_line = lf
7 | indent_size = 2
8 | indent_style = space
9 | insert_final_newline = true
10 | max_line_length = 80
11 | trim_trailing_whitespace = true
12 |
13 | [*.md]
14 | max_line_length = 0
15 | trim_trailing_whitespace = false
16 |
17 | [COMMIT_EDITMSG]
18 | max_line_length = 0
19 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | *.log
3 | .DS_Store
4 |
--------------------------------------------------------------------------------
/.nvrmrc:
--------------------------------------------------------------------------------
1 | v8
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # React Motions
2 |
3 | [](https://circleci.com/gh/raphamorim/react-motions/tree/master)
4 |
5 | > Compose React Animations using High-Order Functions or Components
6 |
7 | React-Motions is a mix of ideas from [Recompose](https://github.com/acdlite/recompose) and [Animate.css](https://github.com/daneden/animate.css). In fact, `react-motions` is a set of pure functions entirely based on animation purpose.
8 |
9 | ```bash
10 | yarn add react-motions --dev
11 | ```
12 |
13 | # Usage
14 |
15 | Using HOF
16 |
17 | ```jsx
18 | import { withBounce, withShake, withInfinite, withSequence } from 'react-motions'
19 |
20 | const Component =
How can I look beautiful
21 |
22 | const ComponentWithShake = withShake(Component)
23 | const ComponentWithShakeAndBounce = withShake(withBounce(Component))
24 | const ComponentWithInfiniteBounce = withInfinite(withBounce(Component))
25 | const ComponentWithShakeThenBounce = withSequence(withShake(withBounce(Component)))
26 | ```
27 |
28 | HOF - Based on Compositions
29 |
30 | You can add compose animations (even custom animations) based on functions. Here is an example:
31 |
32 | ```jsx
33 | import { withShake, withFadeOut, withInfine } from 'react-motions'
34 |
35 | const Component = () => (
36 | withInfinite(
37 | withFadeOut(
38 | withInfinite(
39 | withShake(
40 | Bouncing and Fading Out infinitely!!
41 | )
42 | )
43 | )
44 | )
45 | )
46 | ```
47 |
48 | Using Components
49 |
50 | ```jsx
51 | import { Bounce, Shake } from 'react-motions'
52 |
53 | const ComponentWithShake = () => (
54 |
55 | How can I look beautiful
56 |
57 | )
58 |
59 | const ComponentWithBounce = () => (
60 |
61 | How can I look beautiful
62 |
63 | )
64 | ```
65 |
66 | React-Motions was created to be agnostic to the renderer:
67 |
68 | | React Renderer | Available for use | Version |
69 | | :--- | :--- | :--- |
70 | | [React-DOM](github.com/facebook/react) | ✔️ | `^16` |
71 | | [React-Native](https://github.com/facebook/react-native) | ✖️ | ✖️ |
72 | | [React-TV](https://github.com/raphamorim/react-tv) | ✔️ | `^0.3`
73 |
74 | # API
75 |
76 | ## withInfinite
77 |
78 | Set last animation with `infinity` property.
79 |
80 | ```jsx
81 | import { withInfinite, withBounce } from 'react-motions'
82 |
83 | const DoNotStopBouncing = withInfinite(withBounce(Let's bounce without stop!
))
84 | ```
85 |
86 | ## withSequence
87 |
88 | Execute next animation only after previous animation be finished.
89 |
90 | ```jsx
91 | import { withSequence, withShake, withJello } from 'react-motions'
92 |
93 | const SequencialAnimations = withSequence(
94 | withShake,
95 | withJello,
96 | First shake it then jello!
97 | )
98 | ```
99 |
100 | ## compose
101 |
102 | Execute all animations in the same time.
103 |
104 | ```jsx
105 | import { compose, withFlash, withPulse } from 'react-motions'
106 |
107 | const VividAnimation = compose(
108 | withFlash,
109 | withPulse,
110 | Flash and Pulse!
111 | )
112 | ```
113 |
114 | ## Bounce
115 | ### Component
116 |
117 | Render a React Component with Bounce animation (`2s` duration and iterationCount `infinite`)
118 |
119 | ```jsx
120 | import { Bounce } from 'react-motions'
121 |
122 | const ComponentBounce = (
123 |
124 | Let's bounce here
125 |
126 | )
127 | ```
128 |
129 | ### Function
130 |
131 | Return a React Component with Bounce animation (`1s` duration)
132 |
133 | ```jsx
134 | import { withBounce } from 'react-motions'
135 |
136 | const ComponentWithBounce = withBounce(Let's bounce here
)
137 | ```
138 |
139 | ## FadeIn
140 | ### Component
141 |
142 | Render a React Component with FadeIn animation (`2s` duration and iterationCount `infinite`)
143 |
144 | ```jsx
145 | import { FadeIn } from 'react-motions'
146 |
147 | const ComponentFadeIn = (
148 |
149 | Let's fadeIn here
150 |
151 | )
152 | ```
153 | ### Function
154 |
155 | Return a React Component with FadeIn animation (`1s` duration)
156 |
157 | ```jsx
158 | import { withFadeIn } from 'react-motions'
159 |
160 | const ComponentWithFadeIn = withFadeIn(Let's fadeIn here
)
161 | ```
162 |
163 | ## FadeOut
164 | ### Component
165 |
166 | Render a React Component with FadeOut animation (`2s` duration and iterationCount `infinite`)
167 |
168 | ```jsx
169 | import { FadeOut } from 'react-motions'
170 |
171 | const ComponentFadeOut = (
172 |
173 | Let's fadeOut here
174 |
175 | )
176 | ```
177 | ### Function
178 |
179 | Return a React Component with FadeOut animation (`1s` duration)
180 |
181 | ```jsx
182 | import { withFadeOut } from 'react-motions'
183 |
184 | const ComponentWithFadeOut = withFadeOut(fadeOut here
)
185 | ```
186 |
187 | ## Flash
188 | ### Component
189 |
190 | Render a React Component with Flash animation (`2s` duration and iterationCount `infinite`)
191 |
192 | ```jsx
193 | import { Flash } from 'react-motions'
194 |
195 | const ComponentFlash = (
196 |
197 | Let's flash here
198 |
199 | )
200 | ```
201 | ### Function
202 |
203 | Return a React Component with Flash animation (`1s` duration)
204 |
205 | ```jsx
206 | import { withFlash } from 'react-motions'
207 |
208 | const ComponentWithFlash = withFlash(Flash! Flash!
)
209 | ```
210 |
211 | ## Jello
212 | ### Component
213 |
214 | Render a React Component with Jello animation (`2s` duration and iterationCount `infinite`)
215 |
216 | ```jsx
217 | import { Jello } from 'react-motions'
218 |
219 | const ComponentJello = (
220 |
221 | Let's jello here
222 |
223 | )
224 | ```
225 | ### Function
226 |
227 | Return a React Component with Jello animation (`1s` duration)
228 |
229 | ```jsx
230 | import { withJello } from 'react-motions'
231 |
232 | const ComponentWithJello = withJello(Jelloooool
)
233 | ```
234 |
235 | ## Pulse
236 | ### Component
237 |
238 | Render a React Component with Pulse animation (`2s` duration and iterationCount `infinite`)
239 |
240 | ```jsx
241 | import { Pulse } from 'react-motions'
242 |
243 | const ComponentPulse = (
244 |
245 | Let's pulse here
246 |
247 | )
248 | ```
249 | ### Function
250 |
251 | Return a React Component with Pulse animation (`1s` duration)
252 |
253 | ```jsx
254 | import { withPulse } from 'react-motions'
255 |
256 | const ComponentWithPulse = withPulse(Let's pulse here
)
257 | ```
258 |
259 | ## RubberBand
260 | ### Component
261 |
262 | Render a React Component with RubberBand animation (`2s` duration and iterationCount `infinite`)
263 |
264 | ```jsx
265 | import { RubberBand } from 'react-motions'
266 |
267 | const ComponentRubberBand = (
268 |
269 | Let's rubberBand here
270 |
271 | )
272 | ```
273 | ### Function
274 |
275 | Return a React Component with rubberBand animation (`1s` duration)
276 |
277 | ```jsx
278 | import { withRubberBand } from 'react-motions'
279 |
280 | const ComponentWithRubberBand = withRubberBand(rubberBand!
)
281 | ```
282 |
283 | ## Shake
284 | ### Component
285 |
286 | Render a React Component with Shake animation (`2s` duration and iterationCount `infinite`)
287 |
288 | ```jsx
289 | import { Shake } from 'react-motions'
290 |
291 | const ComponentShake = (
292 |
293 | Let's shake here
294 |
295 | )
296 | ```
297 | ### Function
298 |
299 | Return a React Component with Shake animation (`1s` duration)
300 |
301 | ```jsx
302 | import { withShake } from 'react-motions'
303 |
304 | const ComponentWithShake = withShake(Let's shake here
)
305 | ```
306 | ## Swing
307 | ### Component
308 |
309 | Render a React Component with Swing animation (`2s` duration and iterationCount `infinite`)
310 |
311 | ```jsx
312 | import { Swing } from 'react-motions'
313 |
314 | const ComponentSwing = (
315 |
316 | Let's swing here
317 |
318 | )
319 | ```
320 | ### Function
321 |
322 | Return a React Component with Swing animation (`1s` duration)
323 |
324 | ```jsx
325 | import { withSwing } from 'react-motions'
326 |
327 | const ComponentWithSwing = withSwing(Swing!
)
328 | ```
329 | ## Tada
330 | ### Component
331 |
332 | Render a React Component with Tada animation (`2s` duration and iterationCount `infinite`)
333 |
334 | ```jsx
335 | import { Tada } from 'react-motions'
336 |
337 | const ComponentTada = (
338 |
339 | Let's tada here
340 |
341 | )
342 | ```
343 |
344 | ### Function
345 |
346 | Return a React Component with Tada animation (`1s` duration)
347 |
348 | ```jsx
349 | import { withTada } from 'react-motions'
350 |
351 | const ComponentWithTada = withTada(Tadaaaan!
)
352 | ```
353 | ## Wobble
354 | ### Component
355 |
356 | Render a React Component with Wobble animation (`2s` duration and iterationCount `infinite`)
357 |
358 | ```jsx
359 | import { Wobble } from 'react-motions'
360 |
361 | const ComponentWobble = (
362 |
363 | Let's wobble here
364 |
365 | )
366 | ```
367 | ### Function
368 |
369 | Return a React Component with Wobble animation (`1s` duration)
370 |
371 | ```jsx
372 | import { withWobble } from 'react-motions'
373 |
374 | const ComponentWithWobble = withWobble(Wobble!
)
375 | ```
376 |
377 | # Roadmap
378 |
379 | - [ ] `withSequence`
380 | - [ ] `compose`
381 | - [ ] Create handler props on Components for bind Animation Hooks
382 | - [ ] Allows to configure animation property on HOC
383 |
384 | # Credits
385 |
386 | A thanks to [Animate.css](https://github.com/daneden/animate.css) for all animations.
387 |
388 | Created by [Raphael Amorim](https://twitter.com/raphamorims).
389 |
--------------------------------------------------------------------------------
/docs/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from 'react-dom';
3 | import {
4 | withBounce,
5 | Bounce,
6 | withPulse,
7 | withShake,
8 | withInfinite,
9 | withJello,
10 | Jello,
11 | withTada,
12 | withWobble,
13 | withFlash,
14 | withFadeIn,
15 | withFadeOut,
16 | } from 'react-motions';
17 | import Select from 'react-select';
18 |
19 | const Poster = () => (
20 |
21 |

22 |
23 | )
24 |
25 | const MOTIONS = {
26 | withBounce,
27 | withPulse,
28 | withShake,
29 | withFlash,
30 | withTada,
31 | withWobble,
32 | withJello,
33 | withFadeIn,
34 | withFadeOut,
35 | withBounceInfinite: Component => withInfinite(withBounce(Component)),
36 | withPulseInfinite: Component => withInfinite(withPulse(Component)),
37 | withShakeInfinite: Component => withInfinite(withShake(Component)),
38 | withFlashInfinite: Component => withInfinite(withFlash(Component)),
39 | withTadaInfinite: Component => withInfinite(withTada(Component)),
40 | withWobbleInfinite: Component => withInfinite(withWobble(Component)),
41 | withJelloInfinite: Component => withInfinite(withJello(Component)),
42 | };
43 |
44 | const OPTIONS = [
45 | { label: 'withBounce(Component)', value: 'withBounce' },
46 | { label: 'withPulse(Component)', value: 'withPulse' },
47 | { label: 'withShake(Component)', value: 'withShake' },
48 | { label: 'withFadeIn(Component)', value: 'withFadeIn' },
49 | { label: 'withFadeOut(Component)', value: 'withFadeOut' },
50 | { label: 'withFlash(Component)', value: 'withFlash' },
51 | { label: 'withTada(Component)', value: 'withTada' },
52 | { label: 'withWobble(Component)', value: 'withWobble' },
53 | { label: 'withJello(Component)', value: 'withJello' },
54 | { label: '', value: 'Bounce duration={3}' },
55 | { label: '', value: 'Jello infinite' },
56 | { label: 'withInfinite(withBounce(Component))', value: 'withBounceInfinite' },
57 | { label: 'withInfinite(withPulse(Component))', value: 'withPulseInfinite' },
58 | { label: 'withInfinite(withShake(Component))', value: 'withShakeInfinite' },
59 | { label: 'withInfinite(withFlash(Component))', value: 'withFlashInfinite' },
60 | { label: 'withInfinite(withTada(Component))', value: 'withTadaInfinite' },
61 | { label: 'withInfinite(withWobble(Component))', value: 'withWobbleInfinite' },
62 | { label: 'withInfinite(withJello(Component))', value: 'withJelloInfinite' },
63 | ];
64 |
65 | class Sandbox extends React.Component {
66 | constructor(props) {
67 | super()
68 | this.state = {
69 | value: 'withJello',
70 | example: withJello(Poster()),
71 | code: this.generateCode('withJello')
72 | }
73 | }
74 |
75 | // unproud of this method
76 | generateCode(method) {
77 | method = [ method, `${method}(Component)` ];
78 |
79 | if (method[0].indexOf('with') <= -1) {
80 | const ComponentName = method[0].replace(/ .*/,'')
81 | method = [ ComponentName, `<${method[0]}>${ComponentName}>` ]
82 | }
83 |
84 | if (method[0].indexOf('withInfinite') > -1) {
85 | const effect = method[0].replace('Infinite', '')
86 | method = [ `withInfinite, ${effect}`, `withInfinite(${effect}(Component))` ]
87 | }
88 |
89 | return `
90 | import React from 'react';
91 | import { render } from 'react-dom';
92 | import { ${method[0]} } from 'react-motions';
93 |
94 | const Component = () => (
95 |
96 |

97 |
98 | );
99 |
100 | render(
101 | ${method[1]},
102 | document.querySelector('#root')
103 | );`
104 | }
105 |
106 | onChange(value) {
107 | let example;
108 |
109 | if (value.indexOf('with') <= -1) {
110 | const ComponentName = value.replace(/ .*/,'')
111 | if (ComponentName === 'Bounce') {
112 | example = {Poster()}
113 | } else if (ComponentName === 'Jello') {
114 | example = {Poster()}
115 | }
116 | } else {
117 | example = MOTIONS[value](Poster());
118 | }
119 |
120 | this.setState({
121 | value,
122 | example,
123 | code: this.generateCode(value),
124 | });
125 | }
126 |
127 | render() {
128 | return (
129 |
130 |
140 |
141 |
142 |
143 | { this.state.code }
144 |
145 |
146 |
147 | { this.state.example }
148 |
149 |
150 |
151 | )
152 | }
153 | }
154 |
155 |
156 | function App(argument) {
157 | return (
158 |
169 | );
170 | }
171 |
172 | render(, document.querySelector('#root'));
173 |
--------------------------------------------------------------------------------
/docs/assets/fonts/Lazer84.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raphamorim/react-motions/d43ea7554d70d1460a45e9c5d2b3c5c57fdf6254/docs/assets/fonts/Lazer84.woff2
--------------------------------------------------------------------------------
/docs/assets/images/driver.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raphamorim/react-motions/d43ea7554d70d1460a45e9c5d2b3c5c57fdf6254/docs/assets/images/driver.jpg
--------------------------------------------------------------------------------
/docs/assets/select.css:
--------------------------------------------------------------------------------
1 | /**
2 | * React Select
3 | * ============
4 | * Created by Jed Watson and Joss Mackison for KeystoneJS, http://www.keystonejs.com/
5 | * https://twitter.com/jedwatson https://twitter.com/jossmackison https://twitter.com/keystonejs
6 | * MIT License: https://github.com/JedWatson/react-select
7 | */
8 | .Select {
9 | position: relative;
10 | width: 500px;
11 | }
12 | .Select input::-webkit-contacts-auto-fill-button,
13 | .Select input::-webkit-credentials-auto-fill-button {
14 | display: none !important;
15 | }
16 | .Select input::-ms-clear {
17 | display: none !important;
18 | }
19 | .Select input::-ms-reveal {
20 | display: none !important;
21 | }
22 | .Select,
23 | .Select div,
24 | .Select input,
25 | .Select span {
26 | -webkit-box-sizing: border-box;
27 | -moz-box-sizing: border-box;
28 | box-sizing: border-box;
29 | }
30 | .Select.is-disabled .Select-arrow-zone {
31 | cursor: default;
32 | pointer-events: none;
33 | opacity: 0.35;
34 | }
35 | .Select.is-disabled > .Select-control {
36 | background-color: #f9f9f9;
37 | }
38 | .Select.is-disabled > .Select-control:hover {
39 | box-shadow: none;
40 | }
41 | .Select.is-open > .Select-control {
42 | border-bottom-right-radius: 0;
43 | border-bottom-left-radius: 0;
44 | background: #C22B65;
45 | border-color: #b3b3b3 #ccc #d9d9d9;
46 | }
47 | .Select.is-open > .Select-control .Select-arrow {
48 | top: -2px;
49 | border-color: transparent transparent #999;
50 | border-width: 0 5px 5px;
51 | }
52 | .Select.is-searchable.is-open > .Select-control {
53 | cursor: text;
54 | }
55 | .Select.is-searchable.is-focused:not(.is-open) > .Select-control {
56 | cursor: text;
57 | }
58 | .Select.is-focused > .Select-control {
59 | background: #C22B65;
60 | }
61 | .Select.is-focused:not(.is-open) > .Select-control {
62 | border-color: #007eff;
63 | box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 0 3px rgba(0, 126, 255, 0.1);
64 | background: #C22B65;
65 | }
66 | .Select.has-value.is-clearable.Select--single > .Select-control .Select-value {
67 | padding-right: 42px;
68 | }
69 | .Select.has-value.Select--single > .Select-control .Select-value .Select-value-label,
70 | .Select.has-value.is-pseudo-focused.Select--single > .Select-control .Select-value .Select-value-label {
71 | color: #fff;
72 | }
73 | .Select.has-value.Select--single > .Select-control .Select-value a.Select-value-label,
74 | .Select.has-value.is-pseudo-focused.Select--single > .Select-control .Select-value a.Select-value-label {
75 | cursor: pointer;
76 | text-decoration: none;
77 | }
78 | .Select.has-value.Select--single > .Select-control .Select-value a.Select-value-label:hover,
79 | .Select.has-value.is-pseudo-focused.Select--single > .Select-control .Select-value a.Select-value-label:hover,
80 | .Select.has-value.Select--single > .Select-control .Select-value a.Select-value-label:focus,
81 | .Select.has-value.is-pseudo-focused.Select--single > .Select-control .Select-value a.Select-value-label:focus {
82 | color: #007eff;
83 | outline: none;
84 | text-decoration: underline;
85 | }
86 | .Select.has-value.Select--single > .Select-control .Select-value a.Select-value-label:focus,
87 | .Select.has-value.is-pseudo-focused.Select--single > .Select-control .Select-value a.Select-value-label:focus {
88 | background: #C22B65;
89 | }
90 | .Select.has-value.is-pseudo-focused .Select-input {
91 | opacity: 0;
92 | }
93 | .Select.is-open .Select-arrow,
94 | .Select .Select-arrow-zone:hover > .Select-arrow {
95 | border-top-color: #666;
96 | }
97 | .Select.Select--rtl {
98 | direction: rtl;
99 | text-align: right;
100 | }
101 | .Select-control {
102 | background-color: #C22B65;
103 | border-color: #d9d9d9 #ccc #b3b3b3;
104 | border-radius: 4px;
105 | border: 1px solid #ccc;
106 | color: #fff;
107 | cursor: default;
108 | display: table;
109 | border-spacing: 0;
110 | border-collapse: separate;
111 | height: 36px;
112 | outline: none;
113 | overflow: hidden;
114 | position: relative;
115 | width: 100%;
116 | }
117 | .Select-control:hover {
118 | box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
119 | }
120 | .Select-control .Select-input:focus {
121 | outline: none;
122 | background: #C22B65;
123 | }
124 | .Select-placeholder,
125 | .Select--single > .Select-control .Select-value {
126 | bottom: 0;
127 | color: #3dd49a;
128 | left: 0;
129 | line-height: 34px;
130 | padding-left: 10px;
131 | padding-right: 10px;
132 | position: absolute;
133 | right: 0;
134 | top: 0;
135 | max-width: 100%;
136 | overflow: hidden;
137 | text-overflow: ellipsis;
138 | white-space: nowrap;
139 | }
140 | .Select-input {
141 | height: 34px;
142 | padding-left: 10px;
143 | padding-right: 10px;
144 | vertical-align: middle;
145 | }
146 | .Select-input > input {
147 | width: 100%;
148 | background: none transparent;
149 | border: 0 none;
150 | box-shadow: none;
151 | cursor: default;
152 | display: inline-block;
153 | font-family: inherit;
154 | font-size: inherit;
155 | margin: 0;
156 | outline: none;
157 | line-height: 17px;
158 | /* For IE 8 compatibility */
159 | padding: 8px 0 12px;
160 | /* For IE 8 compatibility */
161 | -webkit-appearance: none;
162 | }
163 | .is-focused .Select-input > input {
164 | cursor: text;
165 | }
166 | .has-value.is-pseudo-focused .Select-input {
167 | opacity: 0;
168 | }
169 | .Select-control:not(.is-searchable) > .Select-input {
170 | outline: none;
171 | }
172 | .Select-loading-zone {
173 | cursor: pointer;
174 | display: table-cell;
175 | position: relative;
176 | text-align: center;
177 | vertical-align: middle;
178 | width: 16px;
179 | }
180 | .Select-loading {
181 | -webkit-animation: Select-animation-spin 400ms infinite linear;
182 | -o-animation: Select-animation-spin 400ms infinite linear;
183 | animation: Select-animation-spin 400ms infinite linear;
184 | width: 16px;
185 | height: 16px;
186 | box-sizing: border-box;
187 | border-radius: 50%;
188 | border: 2px solid #ccc;
189 | border-right-color: #fff;
190 | display: inline-block;
191 | position: relative;
192 | vertical-align: middle;
193 | }
194 | .Select-clear-zone {
195 | -webkit-animation: Select-animation-fadeIn 200ms;
196 | -o-animation: Select-animation-fadeIn 200ms;
197 | animation: Select-animation-fadeIn 200ms;
198 | color: #3dd49a;
199 | cursor: pointer;
200 | display: table-cell;
201 | position: relative;
202 | text-align: center;
203 | vertical-align: middle;
204 | width: 17px;
205 | }
206 | .Select-clear-zone:hover {
207 | color: #3dd49a;
208 | }
209 | .Select-clear {
210 | display: inline-block;
211 | font-size: 18px;
212 | line-height: 1;
213 | }
214 | .Select--multi .Select-clear-zone {
215 | width: 17px;
216 | }
217 | .Select-arrow-zone {
218 | cursor: pointer;
219 | display: table-cell;
220 | position: relative;
221 | text-align: center;
222 | vertical-align: middle;
223 | width: 25px;
224 | padding-right: 5px;
225 | }
226 | .Select--rtl .Select-arrow-zone {
227 | padding-right: 0;
228 | padding-left: 5px;
229 | }
230 | .Select-arrow {
231 | border-color: #999 transparent transparent;
232 | border-style: solid;
233 | border-width: 5px 5px 2.5px;
234 | display: inline-block;
235 | height: 0;
236 | width: 0;
237 | position: relative;
238 | }
239 | .Select-control > *:last-child {
240 | padding-right: 5px;
241 | }
242 | .Select--multi .Select-multi-value-wrapper {
243 | display: inline-block;
244 | }
245 | .Select .Select-aria-only {
246 | position: absolute;
247 | display: inline-block;
248 | height: 1px;
249 | width: 1px;
250 | margin: -1px;
251 | clip: rect(0, 0, 0, 0);
252 | overflow: hidden;
253 | float: left;
254 | }
255 | @-webkit-keyframes Select-animation-fadeIn {
256 | from {
257 | opacity: 0;
258 | }
259 | to {
260 | opacity: 1;
261 | }
262 | }
263 | @keyframes Select-animation-fadeIn {
264 | from {
265 | opacity: 0;
266 | }
267 | to {
268 | opacity: 1;
269 | }
270 | }
271 | .Select-menu-outer {
272 | border-bottom-right-radius: 4px;
273 | border-bottom-left-radius: 4px;
274 | background-color: #C22B65;
275 | border: 1px solid #ccc;
276 | border-top-color: #e6e6e6;
277 | box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
278 | box-sizing: border-box;
279 | margin-top: -1px;
280 | max-height: 200px;
281 | position: absolute;
282 | left: 0;
283 | top: 100%;
284 | width: 100%;
285 | z-index: 1;
286 | -webkit-overflow-scrolling: touch;
287 | }
288 | .Select-menu {
289 | max-height: 198px;
290 | overflow-y: auto;
291 | }
292 | .Select-option {
293 | box-sizing: border-box;
294 | background-color: #C22B65;
295 | color: #3dd49a;
296 | cursor: pointer;
297 | display: block;
298 | padding: 8px 10px;
299 | }
300 | .Select-option:last-child {
301 | border-bottom-right-radius: 4px;
302 | border-bottom-left-radius: 4px;
303 | }
304 | .Select-option.is-selected {
305 | background-color: #f5faff;
306 | /* Fallback color for IE 8 */
307 | background-color: rgba(0, 126, 255, 0.04);
308 | color: #fff;
309 | }
310 | .Select-option.is-focused {
311 | background-color: #ebf5ff;
312 | /* Fallback color for IE 8 */
313 | background-color: rgba(0, 126, 255, 0.08);
314 | color: #fff;
315 | }
316 | .Select-option.is-disabled {
317 | color: #cccccc;
318 | cursor: default;
319 | }
320 | .Select-noresults {
321 | box-sizing: border-box;
322 | color: #999999;
323 | cursor: default;
324 | display: block;
325 | padding: 8px 10px;
326 | }
327 | .Select--multi .Select-input {
328 | vertical-align: middle;
329 | margin-left: 10px;
330 | padding: 0;
331 | }
332 | .Select--multi.Select--rtl .Select-input {
333 | margin-left: 0;
334 | margin-right: 10px;
335 | }
336 | .Select--multi.has-value .Select-input {
337 | margin-left: 5px;
338 | }
339 | .Select--multi .Select-value {
340 | background-color: #ebf5ff;
341 | /* Fallback color for IE 8 */
342 | background-color: rgba(0, 126, 255, 0.08);
343 | border-radius: 2px;
344 | border: 1px solid #c2e0ff;
345 | /* Fallback color for IE 8 */
346 | border: 1px solid rgba(0, 126, 255, 0.24);
347 | color: #007eff;
348 | display: inline-block;
349 | font-size: 0.9em;
350 | line-height: 1.4;
351 | margin-left: 5px;
352 | margin-top: 5px;
353 | vertical-align: top;
354 | }
355 | .Select--multi .Select-value-icon,
356 | .Select--multi .Select-value-label {
357 | display: inline-block;
358 | vertical-align: middle;
359 | }
360 | .Select--multi .Select-value-label {
361 | border-bottom-right-radius: 2px;
362 | border-top-right-radius: 2px;
363 | cursor: default;
364 | padding: 2px 5px;
365 | }
366 | .Select--multi a.Select-value-label {
367 | color: #007eff;
368 | cursor: pointer;
369 | text-decoration: none;
370 | }
371 | .Select--multi a.Select-value-label:hover {
372 | text-decoration: underline;
373 | }
374 | .Select--multi .Select-value-icon {
375 | cursor: pointer;
376 | border-bottom-left-radius: 2px;
377 | border-top-left-radius: 2px;
378 | border-right: 1px solid #c2e0ff;
379 | /* Fallback color for IE 8 */
380 | border-right: 1px solid rgba(0, 126, 255, 0.24);
381 | padding: 1px 5px 3px;
382 | }
383 | .Select--multi .Select-value-icon:hover,
384 | .Select--multi .Select-value-icon:focus {
385 | background-color: #d8eafd;
386 | /* Fallback color for IE 8 */
387 | background-color: rgba(0, 113, 230, 0.08);
388 | color: #0071e6;
389 | }
390 | .Select--multi .Select-value-icon:active {
391 | background-color: #c2e0ff;
392 | /* Fallback color for IE 8 */
393 | background-color: rgba(0, 126, 255, 0.24);
394 | }
395 | .Select--multi.Select--rtl .Select-value {
396 | margin-left: 0;
397 | margin-right: 5px;
398 | }
399 | .Select--multi.Select--rtl .Select-value-icon {
400 | border-right: none;
401 | border-left: 1px solid #c2e0ff;
402 | /* Fallback color for IE 8 */
403 | border-left: 1px solid rgba(0, 126, 255, 0.24);
404 | }
405 | .Select--multi.is-disabled .Select-value {
406 | background-color: #fcfcfc;
407 | border: 1px solid #e3e3e3;
408 | color: #fff;
409 | }
410 | .Select--multi.is-disabled .Select-value-icon {
411 | cursor: not-allowed;
412 | border-right: 1px solid #e3e3e3;
413 | }
414 | .Select--multi.is-disabled .Select-value-icon:hover,
415 | .Select--multi.is-disabled .Select-value-icon:focus,
416 | .Select--multi.is-disabled .Select-value-icon:active {
417 | background-color: #fcfcfc;
418 | }
419 | @keyframes Select-animation-spin {
420 | to {
421 | transform: rotate(1turn);
422 | }
423 | }
424 | @-webkit-keyframes Select-animation-spin {
425 | to {
426 | -webkit-transform: rotate(1turn);
427 | }
428 | }
429 |
--------------------------------------------------------------------------------
/docs/assets/styles.css:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'Lazer84';
3 | font-style: normal;
4 | font-weight: 400;
5 | src: url('fonts/Lazer84.woff2') format('woff2');
6 | }
7 |
8 | body {
9 | background: #201535;
10 | color: #FFF;
11 | font-family: 'OpenSans', Helvetica;
12 | letter-spacing: 0.15em;
13 | width: 100%;
14 | margin: 0 40px;
15 | }
16 |
17 | h1 {
18 | font-weight: 300;
19 | margin: 0;
20 | margin-top: 35px;
21 | padding: 0;
22 | font-size: 60px;
23 | color: #C22B65;
24 | font-family: 'Lazer84', 'OpenSans', Helvetica;
25 | }
26 |
27 | h2 {
28 | font-size: 20px;
29 | }
30 |
31 | p {
32 | font-size: 1.4em;
33 | }
34 |
35 | .container {
36 | display: flex;
37 | }
38 |
39 | select {
40 | letter-spacing: 0.1em;
41 | font-family: Helvetica;
42 | }
43 |
44 | .code {
45 | width: 50%;
46 | letter-spacing: 0.1em;
47 | font-family: Helvetica;
48 | background: #C22B65;
49 | padding: 10px 0 20px 25px;
50 | margin-top: 50px;
51 | height: 10%;
52 | }
53 |
54 | .example {
55 | background: #150e23;
56 | padding: 80px 20px;
57 | text-align: center;
58 | width: 40%;
59 | }
60 |
61 | .poster img {
62 | width: 240px;
63 | }
64 |
65 | pre {
66 | font-family: Helvetica;
67 | }
68 |
69 | .link {
70 | color: #FFF;
71 | text-decoration: none;
72 | font-family: 'Lazer84', 'OpenSans', Helvetica;
73 | font-size: 20px;
74 | transition: all 300ms ease;
75 | }
76 |
77 | .link:hover {
78 | color: #C22B65;
79 | }
80 |
81 |
82 | @media only screen and (max-width:600px) {
83 | body {
84 | margin: 0 20px;
85 | width: auto;
86 | height: 100%;
87 | }
88 |
89 | h2 {
90 | font-size: 16px;
91 | }
92 |
93 | .app {
94 | margin-bottom: 30px;
95 | }
96 |
97 | .code {
98 | display: none;
99 | }
100 |
101 | .example {
102 | width: 100%;
103 | margin: 20px 0;
104 | }
105 |
106 | .link {
107 | font-size: 15px;
108 | }
109 |
110 | .Select {
111 | position: relative;
112 | width: 300px;
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | React Motions - Compose React Animations using High-Order Functions or Components
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-motions-docs",
3 | "version": "1.0.0",
4 | "license": "MIT",
5 | "author": "Raphael Amorim ",
6 | "scripts": {
7 | "start": "webpack-dev-server --progress --colors",
8 | "build": "webpack"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/docs/webpack.config.babel.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const webpack = require('webpack');
3 |
4 | const sourcePath = path.join(__dirname, 'App.js');
5 |
6 | const config = {
7 | mode: 'development',
8 | entry: sourcePath,
9 | output: {
10 | path: __dirname,
11 | filename: 'bundle.js',
12 | },
13 | resolve: {
14 | extensions: ['.js', '.jsx'],
15 | modules: [
16 | sourcePath,
17 | path.resolve(__dirname, 'node_modules'),
18 | path.resolve(__dirname, '../react-motions'),
19 | path.resolve(__dirname, '../node_modules')
20 | ],
21 | },
22 | module: {
23 | rules: [
24 | {
25 | test: /\.(js|jsx)$/,
26 | exclude: /node_modules/,
27 | use: ['babel-loader'],
28 | include: [sourcePath, path.resolve(__dirname, '../react-motions')],
29 | },
30 | ],
31 | },
32 | plugins: [],
33 | devServer: {
34 | compress: true,
35 | port: 9000
36 | },
37 | // optimization: {
38 | // minimize: true
39 | // }
40 | };
41 |
42 | config.plugins.push(
43 | new webpack.DefinePlugin({
44 | 'process.env.NODE_ENV': JSON.stringify('production'),
45 | })
46 | );
47 | config.plugins.push(new webpack.optimize.ModuleConcatenationPlugin());
48 | config.plugins.push(new webpack.HashedModuleIdsPlugin());
49 |
50 | module.exports = config;
51 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "workspaces": [
4 | "docs",
5 | "react-motions"
6 | ],
7 | "scripts": {
8 | "build": "cd react-motions && yarn build",
9 | "build-docs": "cd docs && yarn build",
10 | "test": "jest",
11 | "test:watch": "jest --watch"
12 | },
13 | "devDependencies": {
14 | "babel-core": "^6.26.0",
15 | "babel-jest": "22.4.1",
16 | "babel-loader": "^7.1.2",
17 | "babel-preset-env": "^1.6.1",
18 | "babel-preset-react": "^6.24.1",
19 | "cross-env": "^5.1.1",
20 | "enzyme": "^3.3.0",
21 | "enzyme-adapter-react-16": "^1.1.1",
22 | "fast-memoize": "^2.3.0",
23 | "jest": "22.4.1",
24 | "react": "^16.8.1",
25 | "react-dom": "^16.8.1",
26 | "react-motions": "0.3.2",
27 | "react-select": "^1.2.1",
28 | "webpack": "^4.29.3",
29 | "webpack-cli": "^3.2.3",
30 | "webpack-dev-server": "^3.1.0"
31 | },
32 | "jest": {
33 | "roots": [
34 | "/react-motions"
35 | ],
36 | "setupFiles": [
37 | "./test/setup.js"
38 | ],
39 | "moduleDirectories": [
40 | "node_modules"
41 | ],
42 | "verbose": true,
43 | "resetModules": true
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/react-motions/index.js:
--------------------------------------------------------------------------------
1 | export { Bounce, withBounce } from './src/bounce'
2 | export { default as withInfinite} from './src/withInfinite'
3 | export { FadeIn, withFadeIn } from './src/fadeIn'
4 | export { FadeOut, withFadeOut } from './src/fadeOut'
5 | export { Flash, withFlash } from './src/flash'
6 | export { Jello, withJello } from './src/jello'
7 | export { Pulse, withPulse } from './src/pulse'
8 | export { RubberBand, withRubberBand } from './src/rubberBand'
9 | export { Shake, withShake } from './src/shake'
10 | export { Swing, withSwing } from './src/swing'
11 | export { Tada, withTada } from './src/tada'
12 | export { Wobble, withWobble } from './src/wobble'
13 |
--------------------------------------------------------------------------------
/react-motions/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-motions",
3 | "version": "0.3.2",
4 | "description": "Compose React Animations using High-Order Functions or Components",
5 | "files": [
6 | "react-motions.min.js"
7 | ],
8 | "scripts": {
9 | "build": "webpack"
10 | },
11 | "main": "react-motions.min.js",
12 | "repository": {
13 | "type": "git",
14 | "url": "git+https://github.com/raphamorim/react-motions.git"
15 | },
16 | "keywords": [],
17 | "author": "Raphael Amorim ",
18 | "license": "MIT",
19 | "bugs": {
20 | "url": "https://github.com/raphamorim/react-motions/issues"
21 | },
22 | "homepage": "https://github.com/raphamorim/react-motions#readme"
23 | }
24 |
--------------------------------------------------------------------------------
/react-motions/react-motions.min.js:
--------------------------------------------------------------------------------
1 | !function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define("react-motions",["react"],n):"object"==typeof exports?exports["react-motions"]=n(require("react")):e["react-motions"]=n(e.React)}(window,function(e){return function(e){var n={};function t(i){if(n[i])return n[i].exports;var a=n[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,t),a.l=!0,a.exports}return t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s="QfWi")}({"+AMY":function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=r(t("W0B4"));r(t("+Llh"));function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var n=e.children,t=e.duration,a=e.fillMode,r={animation:{WebkitAnimationName:"flash",animationName:"flash",WebkitAnimationDuration:t+"s",animationDuration:t+"s",WebkitAnimationFillMode:a,animationFillMode:a},infinite:{WebkitAnimationIterationCount:"infinite",animationIterationCount:"infinite"}},o=e.infinite?Object.assign(r.animation,r.infinite):r.animation;return i.default.createElement("div",{style:o},n)}o.propTypes={children:a.default.node.isRequired,duration:a.default.number,fillMode:a.default.string,infinite:a.default.bool},o.defaultProps={duration:1,fillMode:"both",infinite:!1},n.default=o},"+Llh":function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,a=t("F/vR"),r=(i=a)&&i.__esModule?i:{default:i};n.default=(0,r.default)("\n @keyframes flash {\n from,\n 50%,\n to {\n opacity: 1;\n }\n\n 25%,\n 75% {\n opacity: 0;\n }\n }\n")},"/OP+":function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,a=t("F/vR"),r=(i=a)&&i.__esModule?i:{default:i};n.default=(0,r.default)("\n @keyframes jello {\n from,\n 11.1%,\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n }\n\n 22.2% {\n -webkit-transform: skewX(-12.5deg) skewY(-12.5deg);\n transform: skewX(-12.5deg) skewY(-12.5deg);\n }\n\n 33.3% {\n -webkit-transform: skewX(6.25deg) skewY(6.25deg);\n transform: skewX(6.25deg) skewY(6.25deg);\n }\n\n 44.4% {\n -webkit-transform: skewX(-3.125deg) skewY(-3.125deg);\n transform: skewX(-3.125deg) skewY(-3.125deg);\n }\n\n 55.5% {\n -webkit-transform: skewX(1.5625deg) skewY(1.5625deg);\n transform: skewX(1.5625deg) skewY(1.5625deg);\n }\n\n 66.6% {\n -webkit-transform: skewX(-0.78125deg) skewY(-0.78125deg);\n transform: skewX(-0.78125deg) skewY(-0.78125deg);\n }\n\n 77.7% {\n -webkit-transform: skewX(0.390625deg) skewY(0.390625deg);\n transform: skewX(0.390625deg) skewY(0.390625deg);\n }\n\n 88.8% {\n -webkit-transform: skewX(-0.1953125deg) skewY(-0.1953125deg);\n transform: skewX(-0.1953125deg) skewY(-0.1953125deg);\n }\n }\n")},"0BBw":function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=t("h3Zq");Object.defineProperty(n,"Bounce",{enumerable:!0,get:function(){return r(i).default}});var a=t("Zak6");function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"withBounce",{enumerable:!0,get:function(){return r(a).default}})},"0ZnL":function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=t("UGQY");Object.defineProperty(n,"Swing",{enumerable:!0,get:function(){return r(i).default}});var a=t("0uFF");function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"withSwing",{enumerable:!0,get:function(){return r(a).default}})},"0uFF":function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=(r(t("CWQS")),r(t("EZ8+")));function r(e){return e&&e.__esModule?e:{default:e}}n.default=(0,a.default)(function(e){return i.default.createElement("div",{style:{WebkitAnimationName:"swing",animationName:"swing",WebkitAnimationDuration:"1s",animationDuration:"1s",WebkitAnimationFillMode:"both",animationFillMode:"both",WebkitTransformOrigin:"top center",transformOrigin:"top center"}},e)})},"29iW":function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=r(t("W0B4"));r(t("/OP+"));function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var n=e.children,t=e.duration,a=e.fillMode,r=e.infinite,o=e.transformOrigin,u={animation:{WebkitAnimationName:"jello",animationName:"jello",WebkitTransformOrigin:o,transformOrigin:o,WebkitAnimationDuration:t+"s",animationDuration:t+"s",WebkitAnimationFillMode:a,animationFillMode:a},infinite:{WebkitAnimationIterationCount:"infinite",animationIterationCount:"infinite"}},d=r?Object.assign(u.animation,u.infinite):u.animation;return i.default.createElement("div",{style:d},n)}o.propTypes={children:a.default.node.isRequired,duration:a.default.number,fillMode:a.default.string,infinite:a.default.bool,transformOrigin:a.default.string},o.defaultProps={duration:1,fillMode:"both",infinite:!1,transformOrigin:"center"},n.default=o},"6BtY":function(e,n,t){"use strict";function i(e){return function(){return e}}var a=function(){};a.thatReturns=i,a.thatReturnsFalse=i(!1),a.thatReturnsTrue=i(!0),a.thatReturnsNull=i(null),a.thatReturnsThis=function(){return this},a.thatReturnsArgument=function(e){return e},e.exports=a},CWQS:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,a=t("F/vR"),r=(i=a)&&i.__esModule?i:{default:i};n.default=(0,r.default)("\n @keyframes swing {\n 20% {\n -webkit-transform: rotate3d(0, 0, 1, 15deg);\n transform: rotate3d(0, 0, 1, 15deg);\n }\n\n 40% {\n -webkit-transform: rotate3d(0, 0, 1, -10deg);\n transform: rotate3d(0, 0, 1, -10deg);\n }\n\n 60% {\n -webkit-transform: rotate3d(0, 0, 1, 5deg);\n transform: rotate3d(0, 0, 1, 5deg);\n }\n\n 80% {\n -webkit-transform: rotate3d(0, 0, 1, -5deg);\n transform: rotate3d(0, 0, 1, -5deg);\n }\n\n to {\n -webkit-transform: rotate3d(0, 0, 1, 0deg);\n transform: rotate3d(0, 0, 1, 0deg);\n }\n }\n")},D42Q:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=t("JzG0");Object.defineProperty(n,"Wobble",{enumerable:!0,get:function(){return r(i).default}});var a=t("J5IH");function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"withWobble",{enumerable:!0,get:function(){return r(a).default}})},Dj48:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=r(t("W0B4"));r(t("K2Sb"));function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var n=e.children,t=e.duration,a=e.fillMode,r={animation:{WebkitAnimationName:"pulse",animationName:"pulse",WebkitAnimationDuration:t+"s",animationDuration:t+"s",WebkitAnimationFillMode:a,animationFillMode:a},infinite:{WebkitAnimationIterationCount:"infinite",animationIterationCount:"infinite"}},o=e.infinite?Object.assign(r.animation,r.infinite):r.animation;return i.default.createElement("div",{style:o},n)}o.propTypes={children:a.default.node.isRequired,duration:a.default.number,fillMode:a.default.string,infinite:a.default.bool},o.defaultProps={duration:1,fillMode:"both",infinite:!1},n.default=o},E02R:function(e,n,t){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},"EZ8+":function(e,n){function t(e,n,t,i){var a,r=null==(a=i)||"number"==typeof a||"boolean"==typeof a?i:t(i),o=n.get(r);return void 0===o&&(o=e.call(this,i),n.set(r,o)),o}function i(e,n,t){var i=Array.prototype.slice.call(arguments,3),a=t(i),r=n.get(a);return void 0===r&&(r=e.apply(this,i),n.set(a,r)),r}function a(e,n,t,i,a){return t.bind(n,e,i,a)}function r(e,n){return a(e,this,1===e.length?t:i,n.cache.create(),n.serializer)}function o(){return JSON.stringify(arguments)}function u(){this.cache=Object.create(null)}u.prototype.has=function(e){return e in this.cache},u.prototype.get=function(e){return this.cache[e]},u.prototype.set=function(e,n){this.cache[e]=n};var d={create:function(){return new u}};e.exports=function(e,n){var t=n&&n.cache?n.cache:d,i=n&&n.serializer?n.serializer:o;return(n&&n.strategy?n.strategy:r)(e,{cache:t,serializer:i})},e.exports.strategies={variadic:function(e,n){return a(e,this,i,n.cache.create(),n.serializer)},monadic:function(e,n){return a(e,this,t,n.cache.create(),n.serializer)}}},"F/vR":function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.default=function(e){var n=document.createElement("style"),t=null;document.head.appendChild(n),(t=n.sheet).insertRule(e,t.cssRules.length)}},F6Y0:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,a=t("F/vR"),r=(i=a)&&i.__esModule?i:{default:i};n.default=(0,r.default)("\n @keyframes rubberBand {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1);\n }\n\n 30% {\n -webkit-transform: scale3d(1.25, 0.75, 1);\n transform: scale3d(1.25, 0.75, 1);\n }\n\n 40% {\n -webkit-transform: scale3d(0.75, 1.25, 1);\n transform: scale3d(0.75, 1.25, 1);\n }\n\n 50% {\n -webkit-transform: scale3d(1.15, 0.85, 1);\n transform: scale3d(1.15, 0.85, 1);\n }\n\n 65% {\n -webkit-transform: scale3d(0.95, 1.05, 1);\n transform: scale3d(0.95, 1.05, 1);\n }\n\n 75% {\n -webkit-transform: scale3d(1.05, 0.95, 1);\n transform: scale3d(1.05, 0.95, 1);\n }\n\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1);\n }\n }\n")},F6pi:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=(r(t("+Llh")),r(t("EZ8+")));function r(e){return e&&e.__esModule?e:{default:e}}n.default=(0,a.default)(function(e){return i.default.createElement("div",{style:{WebkitAnimationName:"flash",animationName:"flash",WebkitAnimationDuration:"1s",animationDuration:"1s",WebkitAnimationFillMode:"both",animationFillMode:"both"}},e)})},Ft4H:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=r(t("W0B4"));r(t("Q3dY"));function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var n=e.children,t=e.duration,a=e.fillMode,r={animation:{WebkitAnimationName:"fadeOut",animationName:"fadeOut",WebkitAnimationDuration:t+"s",animationDuration:t+"s",WebkitAnimationFillMode:a,animationFillMode:a},infinite:{WebkitAnimationIterationCount:"infinite",animationIterationCount:"infinite"}},o=e.infinite?Object.assign(r.animation,r.infinite):r.animation;return i.default.createElement("div",{style:o},n)}o.propTypes={children:a.default.node.isRequired,duration:a.default.number,fillMode:a.default.string,infinite:a.default.bool},o.defaultProps={duration:1,fillMode:"both",infinite:!1},n.default=o},G0k2:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=t("x5iJ");Object.defineProperty(n,"FadeIn",{enumerable:!0,get:function(){return r(i).default}});var a=t("hC6F");function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"withFadeIn",{enumerable:!0,get:function(){return r(a).default}})},J5IH:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=(r(t("Ta4o")),r(t("EZ8+")));function r(e){return e&&e.__esModule?e:{default:e}}n.default=(0,a.default)(function(e){return i.default.createElement("div",{style:{WebkitAnimationName:"wobble",animationName:"wobble",WebkitAnimationDuration:"1s",animationDuration:"1s",WebkitAnimationFillMode:"both",animationFillMode:"both"}},e)})},JzG0:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=r(t("W0B4"));r(t("Ta4o"));function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var n=e.children,t=e.duration,a=e.fillMode,r={animation:{WebkitAnimationName:"wobble",animationName:"wobble",WebkitAnimationDuration:t+"s",animationDuration:t+"s",WebkitAnimationFillMode:a,animationFillMode:a},infinite:{WebkitAnimationIterationCount:"infinite",animationIterationCount:"infinite"}},o=e.infinite?Object.assign(r.animation,r.infinite):r.animation;return i.default.createElement("div",{style:o},n)}o.propTypes={children:a.default.node.isRequired,duration:a.default.number,fillMode:a.default.string,infinite:a.default.bool},o.defaultProps={duration:1,fillMode:"both",infinite:!1},n.default=o},K2Sb:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,a=t("F/vR"),r=(i=a)&&i.__esModule?i:{default:i};n.default=(0,r.default)("\n @keyframes pulse {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1);\n }\n\n 50% {\n -webkit-transform: scale3d(1.05, 1.05, 1.05);\n transform: scale3d(1.05, 1.05, 1.05);\n }\n\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1);\n }\n }\n")},KAlO:function(e,n,t){"use strict";var i=function(e){};e.exports=function(e,n,t,a,r,o,u,d){if(i(n),!e){var l;if(void 0===n)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[t,a,r,o,u,d],s=0;(l=new Error(n.replace(/%s/g,function(){return f[s++]}))).name="Invariant Violation"}throw l.framesToPop=1,l}}},L1fi:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=(r(t("K2Sb")),r(t("EZ8+")));function r(e){return e&&e.__esModule?e:{default:e}}n.default=(0,a.default)(function(e){return i.default.createElement("div",{style:{WebkitAnimationName:"pulse",animationName:"pulse",WebkitAnimationDuration:"1s",animationDuration:"1s",WebkitAnimationFillMode:"both",animationFillMode:"both"}},e)})},M9jh:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=(r(t("a4iP")),r(t("EZ8+")));function r(e){return e&&e.__esModule?e:{default:e}}n.default=(0,a.default)(function(e){return i.default.createElement("div",{style:{WebkitAnimationName:"shake",animationName:"shake",WebkitAnimationDuration:"1s",animationDuration:"1s",WebkitAnimationFillMode:"both",animationFillMode:"both"}},e)})},NS33:function(e,n,t){"use strict";var i=t("6BtY"),a=t("KAlO"),r=t("E02R");e.exports=function(){function e(e,n,t,i,o,u){u!==r&&a(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function n(){return e}e.isRequired=e;var t={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:n,element:e,instanceOf:n,node:e,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n};return t.checkPropTypes=i,t.PropTypes=t,t}},O0eE:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=t("Dj48");Object.defineProperty(n,"Pulse",{enumerable:!0,get:function(){return r(i).default}});var a=t("L1fi");function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"withPulse",{enumerable:!0,get:function(){return r(a).default}})},PFHo:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});a(t("cDcd"));var i=a(t("EZ8+"));function a(e){return e&&e.__esModule?e:{default:e}}n.default=(0,i.default)(function(e){return e.props.style.WebkitAnimationIterationCount="infinite",e.props.style.animationIterationCount="infinite",e})},Q3dY:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,a=t("F/vR"),r=(i=a)&&i.__esModule?i:{default:i};n.default=(0,r.default)("\n @keyframes fadeOut {\n from {\n opacity: 1;\n }\n\n to {\n opacity: 0;\n }\n }\n")},QIPB:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=(r(t("ZvNq")),r(t("EZ8+")));function r(e){return e&&e.__esModule?e:{default:e}}n.default=(0,a.default)(function(e){return i.default.createElement("div",{style:{WebkitAnimationName:"tada",animationName:"tada",WebkitAnimationDuration:"1s",animationDuration:"1s",WebkitAnimationFillMode:"both",animationFillMode:"both"}},e)})},QfWi:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=t("0BBw");Object.defineProperty(n,"Bounce",{enumerable:!0,get:function(){return i.Bounce}}),Object.defineProperty(n,"withBounce",{enumerable:!0,get:function(){return i.withBounce}});var a=t("PFHo");Object.defineProperty(n,"withInfinite",{enumerable:!0,get:function(){return(e=a,e&&e.__esModule?e:{default:e}).default;var e}});var r=t("G0k2");Object.defineProperty(n,"FadeIn",{enumerable:!0,get:function(){return r.FadeIn}}),Object.defineProperty(n,"withFadeIn",{enumerable:!0,get:function(){return r.withFadeIn}});var o=t("e7Y8");Object.defineProperty(n,"FadeOut",{enumerable:!0,get:function(){return o.FadeOut}}),Object.defineProperty(n,"withFadeOut",{enumerable:!0,get:function(){return o.withFadeOut}});var u=t("Sazq");Object.defineProperty(n,"Flash",{enumerable:!0,get:function(){return u.Flash}}),Object.defineProperty(n,"withFlash",{enumerable:!0,get:function(){return u.withFlash}});var d=t("SrUD");Object.defineProperty(n,"Jello",{enumerable:!0,get:function(){return d.Jello}}),Object.defineProperty(n,"withJello",{enumerable:!0,get:function(){return d.withJello}});var l=t("O0eE");Object.defineProperty(n,"Pulse",{enumerable:!0,get:function(){return l.Pulse}}),Object.defineProperty(n,"withPulse",{enumerable:!0,get:function(){return l.withPulse}});var f=t("w/tx");Object.defineProperty(n,"RubberBand",{enumerable:!0,get:function(){return f.RubberBand}}),Object.defineProperty(n,"withRubberBand",{enumerable:!0,get:function(){return f.withRubberBand}});var s=t("ToLk");Object.defineProperty(n,"Shake",{enumerable:!0,get:function(){return s.Shake}}),Object.defineProperty(n,"withShake",{enumerable:!0,get:function(){return s.withShake}});var c=t("0ZnL");Object.defineProperty(n,"Swing",{enumerable:!0,get:function(){return c.Swing}}),Object.defineProperty(n,"withSwing",{enumerable:!0,get:function(){return c.withSwing}});var m=t("pK/n");Object.defineProperty(n,"Tada",{enumerable:!0,get:function(){return m.Tada}}),Object.defineProperty(n,"withTada",{enumerable:!0,get:function(){return m.withTada}});var b=t("D42Q");Object.defineProperty(n,"Wobble",{enumerable:!0,get:function(){return b.Wobble}}),Object.defineProperty(n,"withWobble",{enumerable:!0,get:function(){return b.withWobble}})},Sazq:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=t("+AMY");Object.defineProperty(n,"Flash",{enumerable:!0,get:function(){return r(i).default}});var a=t("F6pi");function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"withFlash",{enumerable:!0,get:function(){return r(a).default}})},Sec1:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=(r(t("/OP+")),r(t("EZ8+")));function r(e){return e&&e.__esModule?e:{default:e}}n.default=(0,a.default)(function(e){return i.default.createElement("div",{style:{WebkitAnimationName:"jello",animationName:"jello",WebkitTransformOrigin:"center",transformOrigin:"center",WebkitAnimationDuration:"1s",animationDuration:"1s",WebkitAnimationFillMode:"both",animationFillMode:"both"}},e)})},SrUD:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=t("29iW");Object.defineProperty(n,"Jello",{enumerable:!0,get:function(){return r(i).default}});var a=t("Sec1");function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"withJello",{enumerable:!0,get:function(){return r(a).default}})},Ta4o:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,a=t("F/vR"),r=(i=a)&&i.__esModule?i:{default:i};n.default=(0,r.default)("\n @keyframes wobble {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n }\n\n 15% {\n -webkit-transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);\n transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);\n }\n\n 30% {\n -webkit-transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);\n transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);\n }\n\n 45% {\n -webkit-transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);\n transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);\n }\n\n 60% {\n -webkit-transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);\n transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);\n }\n\n 75% {\n -webkit-transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);\n transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);\n }\n\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n }\n }\n")},ToLk:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=t("mkX9");Object.defineProperty(n,"Shake",{enumerable:!0,get:function(){return r(i).default}});var a=t("M9jh");function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"withShake",{enumerable:!0,get:function(){return r(a).default}})},UGQY:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=r(t("W0B4"));r(t("CWQS"));function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var n=e.children,t=e.duration,a=e.fillMode,r=e.infinite,o=e.transformOrigin,u={animation:{WebkitAnimationName:"swing",animationName:"swing",WebkitTransformOrigin:o,transformOrigin:o,WebkitAnimationDuration:t+"s",animationDuration:t+"s",WebkitAnimationFillMode:a,animationFillMode:a},infinite:{WebkitAnimationIterationCount:"infinite",animationIterationCount:"infinite"}},d=r?Object.assign(u.animation,u.infinite):u.animation;return i.default.createElement("div",{style:d},n)}o.propTypes={children:a.default.node.isRequired,duration:a.default.number,fillMode:a.default.string,infinite:a.default.bool,transformOrigin:a.default.string},o.defaultProps={duration:1,fillMode:"both",infinite:!1,transformOrigin:"top center"},n.default=o},W0B4:function(e,n,t){e.exports=t("NS33")()},Zak6:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=(r(t("wMSU")),r(t("EZ8+")));function r(e){return e&&e.__esModule?e:{default:e}}n.default=(0,a.default)(function(e){return i.default.createElement("div",{style:{WebkitAnimationName:"bounce",animationName:"bounce",WebkitTransformOrigin:"center bottom",transformOrigin:"center bottom",WebkitAnimationDuration:"1s",animationDuration:"1s",WebkitAnimationFillMode:"both",animationFillMode:"both"}},e)})},ZvNq:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,a=t("F/vR"),r=(i=a)&&i.__esModule?i:{default:i};n.default=(0,r.default)("\n @keyframes tada {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1);\n }\n\n 10%,\n 20% {\n -webkit-transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg);\n transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg);\n }\n\n 30%,\n 50%,\n 70%,\n 90% {\n -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);\n transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);\n }\n\n 40%,\n 60%,\n 80% {\n -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);\n transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);\n }\n\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1);\n }\n }\n")},a4iP:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,a=t("F/vR"),r=(i=a)&&i.__esModule?i:{default:i};n.default=(0,r.default)("\n @keyframes shake {\n from,\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n }\n\n 10%,\n 30%,\n 50%,\n 70%,\n 90% {\n -webkit-transform: translate3d(-10px, 0, 0);\n transform: translate3d(-10px, 0, 0);\n }\n\n 20%,\n 40%,\n 60%,\n 80% {\n -webkit-transform: translate3d(10px, 0, 0);\n transform: translate3d(10px, 0, 0);\n }\n }\n")},cDcd:function(n,t){n.exports=e},dLxh:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=r(t("W0B4"));r(t("ZvNq"));function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var n=e.children,t=e.duration,a=e.fillMode,r={animation:{WebkitAnimationName:"tada",animationName:"tada",WebkitAnimationDuration:t+"s",animationDuration:t+"s",WebkitAnimationFillMode:a,animationFillMode:a},infinite:{WebkitAnimationIterationCount:"infinite",animationIterationCount:"infinite"}},o=e.infinite?Object.assign(r.animation,r.infinite):r.animation;return i.default.createElement("div",{style:o},n)}o.propTypes={children:a.default.node.isRequired,duration:a.default.number,fillMode:a.default.string,infinite:a.default.bool},o.defaultProps={duration:1,fillMode:"both",infinite:!1},n.default=o},e7Y8:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=t("Ft4H");Object.defineProperty(n,"FadeOut",{enumerable:!0,get:function(){return r(i).default}});var a=t("q40a");function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"withFadeOut",{enumerable:!0,get:function(){return r(a).default}})},h3Zq:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=r(t("W0B4"));r(t("wMSU"));function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var n=e.children,t=e.duration,a=e.fillMode,r=e.infinite,o=e.transformOrigin,u={animation:{WebkitAnimationName:"bounce",animationName:"bounce",WebkitTransformOrigin:o,transformOrigin:o,WebkitAnimationDuration:t+"s",animationDuration:t+"s",WebkitAnimationFillMode:a,animationFillMode:a},infinite:{WebkitAnimationIterationCount:"infinite",animationIterationCount:"infinite"}},d=r?Object.assign(u.animation,u.infinite):u.animation;return i.default.createElement("div",{style:d},n)}o.propTypes={children:a.default.node.isRequired,duration:a.default.number,fillMode:a.default.string,infinite:a.default.bool,transformOrigin:a.default.string},o.defaultProps={duration:1,fillMode:"both",infinite:!1,transformOrigin:"center bottom"},n.default=o},hC6F:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=(r(t("zMm2")),r(t("EZ8+")));function r(e){return e&&e.__esModule?e:{default:e}}n.default=(0,a.default)(function(e){return i.default.createElement("div",{style:{WebkitAnimationName:"fadeIn",animationName:"fadeIn",WebkitAnimationDuration:"1s",animationDuration:"1s",WebkitAnimationFillMode:"both",animationFillMode:"both"}},e)})},mkX9:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=r(t("W0B4"));r(t("a4iP"));function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var n=e.children,t=e.duration,a=e.fillMode,r={animation:{WebkitAnimationName:"shake",animationName:"shake",WebkitAnimationDuration:t+"s",animationDuration:t+"s",WebkitAnimationFillMode:a,animationFillMode:a},infinite:{WebkitAnimationIterationCount:"infinite",animationIterationCount:"infinite"}},o=e.infinite?Object.assign(r.animation,r.infinite):r.animation;return i.default.createElement("div",{style:o},n)}o.propTypes={children:a.default.node.isRequired,duration:a.default.number,fillMode:a.default.string,infinite:a.default.bool},o.defaultProps={duration:1,fillMode:"both",infinite:!1},n.default=o},"pK/n":function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=t("dLxh");Object.defineProperty(n,"Tada",{enumerable:!0,get:function(){return r(i).default}});var a=t("QIPB");function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"withTada",{enumerable:!0,get:function(){return r(a).default}})},q40a:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=(r(t("Q3dY")),r(t("EZ8+")));function r(e){return e&&e.__esModule?e:{default:e}}n.default=(0,a.default)(function(e){return i.default.createElement("div",{style:{WebkitAnimationName:"fadeOut",animationName:"fadeOut",WebkitAnimationDuration:"1s",animationDuration:"1s",WebkitAnimationFillMode:"both",animationFillMode:"both"}},e)})},"w/tx":function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=t("xo+T");Object.defineProperty(n,"RubberBand",{enumerable:!0,get:function(){return r(i).default}});var a=t("zjPQ");function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"withRubberBand",{enumerable:!0,get:function(){return r(a).default}})},wMSU:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,a=t("F/vR"),r=(i=a)&&i.__esModule?i:{default:i};n.default=(0,r.default)("\n @keyframes bounce {\n from,\n 20%,\n 53%,\n 80%,\n to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n }\n\n 40%,\n 43% {\n -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n -webkit-transform: translate3d(0, -30px, 0);\n transform: translate3d(0, -30px, 0);\n }\n\n 70% {\n -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n -webkit-transform: translate3d(0, -15px, 0);\n transform: translate3d(0, -15px, 0);\n }\n\n 90% {\n -webkit-transform: translate3d(0, -4px, 0);\n transform: translate3d(0, -4px, 0);\n }\n }\n")},x5iJ:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=r(t("W0B4"));r(t("zMm2"));function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var n=e.children,t=e.duration,a=e.fillMode,r={animation:{WebkitAnimationName:"fadeIn",animationName:"fadeIn",WebkitAnimationDuration:t+"s",animationDuration:t+"s",WebkitAnimationFillMode:a,animationFillMode:a},infinite:{WebkitAnimationIterationCount:"infinite",animationIterationCount:"infinite"}},o=e.infinite?Object.assign(r.animation,r.infinite):r.animation;return i.default.createElement("div",{style:o},n)}o.propTypes={children:a.default.node.isRequired,duration:a.default.number,fillMode:a.default.string,infinite:a.default.bool},o.defaultProps={duration:1,fillMode:"both",infinite:!1},n.default=o},"xo+T":function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=r(t("W0B4"));r(t("F6Y0"));function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var n=e.children,t=e.duration,a=e.fillMode,r={animation:{WebkitAnimationName:"rubberBand",animationName:"rubberBand",WebkitAnimationDuration:t+"s",animationDuration:t+"s",WebkitAnimationFillMode:a,animationFillMode:a},infinite:{WebkitAnimationIterationCount:"infinite",animationIterationCount:"infinite"}},o=e.infinite?Object.assign(r.animation,r.infinite):r.animation;return i.default.createElement("div",{style:o},n)}o.propTypes={children:a.default.node.isRequired,duration:a.default.number,fillMode:a.default.string,infinite:a.default.bool},o.defaultProps={duration:1,fillMode:"both",infinite:!1},n.default=o},zMm2:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,a=t("F/vR"),r=(i=a)&&i.__esModule?i:{default:i};n.default=(0,r.default)("\n @keyframes fadeIn {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n }\n")},zjPQ:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("cDcd")),a=(r(t("F6Y0")),r(t("EZ8+")));function r(e){return e&&e.__esModule?e:{default:e}}n.default=(0,a.default)(function(e){return i.default.createElement("div",{style:{WebkitAnimationName:"rubberBand",animationName:"rubberBand",WebkitAnimationDuration:"1s",animationDuration:"1s",WebkitAnimationFillMode:"both",animationFillMode:"both"}},e)})}})});
--------------------------------------------------------------------------------
/react-motions/src/bounce/__tests__/__snapshots__/bounce-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Bounce should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
13 | Bounce
14 | ,
15 | Symbol(enzyme.__renderer__): Object {
16 | "batchedUpdates": [Function],
17 | "getNode": [Function],
18 | "render": [Function],
19 | "simulateEvent": [Function],
20 | "unmount": [Function],
21 | },
22 | Symbol(enzyme.__node__): Object {
23 | "instance": null,
24 | "key": undefined,
25 | "nodeType": "host",
26 | "props": Object {
27 | "children": "Bounce",
28 | "style": Object {
29 | "WebkitAnimationDuration": "1s",
30 | "WebkitAnimationFillMode": "both",
31 | "WebkitAnimationName": "bounce",
32 | "WebkitTransformOrigin": "center bottom",
33 | "animationDuration": "1s",
34 | "animationFillMode": "both",
35 | "animationName": "bounce",
36 | "transformOrigin": "center bottom",
37 | },
38 | },
39 | "ref": null,
40 | "rendered": "Bounce",
41 | "type": "div",
42 | },
43 | Symbol(enzyme.__nodes__): Array [
44 | Object {
45 | "instance": null,
46 | "key": undefined,
47 | "nodeType": "host",
48 | "props": Object {
49 | "children": "Bounce",
50 | "style": Object {
51 | "WebkitAnimationDuration": "1s",
52 | "WebkitAnimationFillMode": "both",
53 | "WebkitAnimationName": "bounce",
54 | "WebkitTransformOrigin": "center bottom",
55 | "animationDuration": "1s",
56 | "animationFillMode": "both",
57 | "animationName": "bounce",
58 | "transformOrigin": "center bottom",
59 | },
60 | },
61 | "ref": null,
62 | "rendered": "Bounce",
63 | "type": "div",
64 | },
65 | ],
66 | Symbol(enzyme.__options__): Object {
67 | "adapter": ReactSixteenAdapter {
68 | "options": Object {
69 | "enableComponentDidUpdateOnSetState": true,
70 | },
71 | },
72 | },
73 | }
74 | `;
75 |
--------------------------------------------------------------------------------
/react-motions/src/bounce/__tests__/__snapshots__/withBounce-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`withBounce should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
21 |
22 | Bounce
23 |
24 |
,
25 | Symbol(enzyme.__renderer__): Object {
26 | "batchedUpdates": [Function],
27 | "getNode": [Function],
28 | "render": [Function],
29 | "simulateEvent": [Function],
30 | "unmount": [Function],
31 | },
32 | Symbol(enzyme.__node__): Object {
33 | "instance": null,
34 | "key": undefined,
35 | "nodeType": "host",
36 | "props": Object {
37 | "children":
38 | Bounce
39 |
,
40 | "style": Object {
41 | "WebkitAnimationDuration": "1s",
42 | "WebkitAnimationFillMode": "both",
43 | "WebkitAnimationName": "bounce",
44 | "WebkitTransformOrigin": "center bottom",
45 | "animationDuration": "1s",
46 | "animationFillMode": "both",
47 | "animationName": "bounce",
48 | "transformOrigin": "center bottom",
49 | },
50 | },
51 | "ref": null,
52 | "rendered": Object {
53 | "instance": null,
54 | "key": undefined,
55 | "nodeType": "host",
56 | "props": Object {
57 | "children": "Bounce",
58 | },
59 | "ref": null,
60 | "rendered": "Bounce",
61 | "type": "div",
62 | },
63 | "type": "div",
64 | },
65 | Symbol(enzyme.__nodes__): Array [
66 | Object {
67 | "instance": null,
68 | "key": undefined,
69 | "nodeType": "host",
70 | "props": Object {
71 | "children":
72 | Bounce
73 |
,
74 | "style": Object {
75 | "WebkitAnimationDuration": "1s",
76 | "WebkitAnimationFillMode": "both",
77 | "WebkitAnimationName": "bounce",
78 | "WebkitTransformOrigin": "center bottom",
79 | "animationDuration": "1s",
80 | "animationFillMode": "both",
81 | "animationName": "bounce",
82 | "transformOrigin": "center bottom",
83 | },
84 | },
85 | "ref": null,
86 | "rendered": Object {
87 | "instance": null,
88 | "key": undefined,
89 | "nodeType": "host",
90 | "props": Object {
91 | "children": "Bounce",
92 | },
93 | "ref": null,
94 | "rendered": "Bounce",
95 | "type": "div",
96 | },
97 | "type": "div",
98 | },
99 | ],
100 | Symbol(enzyme.__options__): Object {
101 | "adapter": ReactSixteenAdapter {
102 | "options": Object {
103 | "enableComponentDidUpdateOnSetState": true,
104 | },
105 | },
106 | },
107 | }
108 | `;
109 |
--------------------------------------------------------------------------------
/react-motions/src/bounce/__tests__/bounce-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { mount } from 'enzyme';
3 | import Bounce from '../bounce';
4 |
5 | describe('Bounce', () => {
6 | it('should render', () => {
7 | const wrapper = shallow(Bounce);
8 |
9 | expect(wrapper).toMatchSnapshot();
10 | });
11 | it('should receive duration prop', () => {
12 | const wrapper = mount(Bounce);
13 |
14 | expect(wrapper.props().duration).toEqual(3);
15 | });
16 | it('should receive fillMode prop', () => {
17 | const wrapper = mount(Bounce);
18 | expect(wrapper.props().fillMode).toEqual("both");
19 | });
20 | it('should receive transformOrigin prop', () => {
21 | const wrapper = mount(Bounce);
22 | expect(wrapper.props().transformOrigin).toEqual("center bottom");
23 | });
24 | it('should render correctly when infinite', () => {
25 | const wrapper = mount(Bounce);
26 |
27 | expect(wrapper.props().infinite).toBe(true);
28 | });
29 | });
30 |
--------------------------------------------------------------------------------
/react-motions/src/bounce/__tests__/withBounce-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import withBounce from '../withBounce';
3 |
4 | describe('withBounce', () => {
5 | it('should render', () => {
6 | const wrapper = shallow(withBounce(Bounce
));
7 |
8 | expect(wrapper).toMatchSnapshot();
9 | });
10 | });
11 |
--------------------------------------------------------------------------------
/react-motions/src/bounce/bounce.css:
--------------------------------------------------------------------------------
1 | @-webkit-keyframes bounce {
2 | from,
3 | 20%,
4 | 53%,
5 | 80%,
6 | to {
7 | -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
8 | animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
9 | -webkit-transform: translate3d(0, 0, 0);
10 | transform: translate3d(0, 0, 0);
11 | }
12 |
13 | 40%,
14 | 43% {
15 | -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
16 | animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
17 | -webkit-transform: translate3d(0, -30px, 0);
18 | transform: translate3d(0, -30px, 0);
19 | }
20 |
21 | 70% {
22 | -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
23 | animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
24 | -webkit-transform: translate3d(0, -15px, 0);
25 | transform: translate3d(0, -15px, 0);
26 | }
27 |
28 | 90% {
29 | -webkit-transform: translate3d(0, -4px, 0);
30 | transform: translate3d(0, -4px, 0);
31 | }
32 | }
33 |
34 | @keyframes bounce {
35 | from,
36 | 20%,
37 | 53%,
38 | 80%,
39 | to {
40 | -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
41 | animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
42 | -webkit-transform: translate3d(0, 0, 0);
43 | transform: translate3d(0, 0, 0);
44 | }
45 |
46 | 40%,
47 | 43% {
48 | -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
49 | animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
50 | -webkit-transform: translate3d(0, -30px, 0);
51 | transform: translate3d(0, -30px, 0);
52 | }
53 |
54 | 70% {
55 | -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
56 | animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
57 | -webkit-transform: translate3d(0, -15px, 0);
58 | transform: translate3d(0, -15px, 0);
59 | }
60 |
61 | 90% {
62 | -webkit-transform: translate3d(0, -4px, 0);
63 | transform: translate3d(0, -4px, 0);
64 | }
65 | }
66 |
67 | .bounce {
68 | -webkit-animation-name: bounce;
69 | animation-name: bounce;
70 | -webkit-transform-origin: center bottom;
71 | transform-origin: center bottom;
72 |
73 | -webkit-animation-duration: 1s;
74 | animation-duration: 1s;
75 | -webkit-animation-fill-mode: both;
76 | animation-fill-mode: both;
77 | }
78 |
--------------------------------------------------------------------------------
/react-motions/src/bounce/bounce.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PropTypes from 'prop-types'
3 | import styles from './styles'
4 |
5 | function Bounce({ children, duration, fillMode, infinite, transformOrigin }) {
6 | const style = {
7 | animation: {
8 | WebkitAnimationName: "bounce",
9 | animationName: "bounce",
10 | WebkitTransformOrigin: transformOrigin,
11 | transformOrigin,
12 | WebkitAnimationDuration: `${duration}s`,
13 | animationDuration: `${duration}s`,
14 | WebkitAnimationFillMode: fillMode,
15 | animationFillMode: fillMode
16 | },
17 | infinite: {
18 | WebkitAnimationIterationCount: "infinite",
19 | animationIterationCount: "infinite",
20 | }
21 | }
22 |
23 | const styleComponent = infinite
24 | ? Object.assign(style.animation, style.infinite)
25 | : style.animation
26 |
27 | return (
28 |
29 | {children}
30 |
31 | )
32 | }
33 |
34 | Bounce.propTypes = {
35 | children: PropTypes.node.isRequired,
36 | duration: PropTypes.number,
37 | fillMode: PropTypes.string,
38 | infinite: PropTypes.bool,
39 | transformOrigin: PropTypes.string,
40 | }
41 |
42 | Bounce.defaultProps = {
43 | duration: 1,
44 | fillMode: "both",
45 | infinite: false,
46 | transformOrigin: "center bottom"
47 | }
48 |
49 | export default Bounce
50 |
--------------------------------------------------------------------------------
/react-motions/src/bounce/index.js:
--------------------------------------------------------------------------------
1 | export { default as Bounce } from './bounce'
2 | export { default as withBounce } from './withBounce'
--------------------------------------------------------------------------------
/react-motions/src/bounce/styles.js:
--------------------------------------------------------------------------------
1 | import injectStyles from '../injectStyles'
2 |
3 | export default injectStyles(`
4 | @keyframes bounce {
5 | from,
6 | 20%,
7 | 53%,
8 | 80%,
9 | to {
10 | -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
11 | animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
12 | -webkit-transform: translate3d(0, 0, 0);
13 | transform: translate3d(0, 0, 0);
14 | }
15 |
16 | 40%,
17 | 43% {
18 | -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
19 | animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
20 | -webkit-transform: translate3d(0, -30px, 0);
21 | transform: translate3d(0, -30px, 0);
22 | }
23 |
24 | 70% {
25 | -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
26 | animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
27 | -webkit-transform: translate3d(0, -15px, 0);
28 | transform: translate3d(0, -15px, 0);
29 | }
30 |
31 | 90% {
32 | -webkit-transform: translate3d(0, -4px, 0);
33 | transform: translate3d(0, -4px, 0);
34 | }
35 | }
36 | `)
37 |
--------------------------------------------------------------------------------
/react-motions/src/bounce/withBounce.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import styles from './styles'
3 | import memoize from 'fast-memoize'
4 |
5 | function withBounce(Component) {
6 | const style = {
7 | WebkitAnimationName: "bounce",
8 | animationName: "bounce",
9 | WebkitTransformOrigin: "center bottom",
10 | transformOrigin: "center bottom",
11 | WebkitAnimationDuration: "1s",
12 | animationDuration: "1s",
13 | WebkitAnimationFillMode: "both",
14 | animationFillMode: "both"
15 | }
16 |
17 | return (
18 |
19 | {Component}
20 |
21 | )
22 | }
23 |
24 | export default memoize(withBounce)
25 |
--------------------------------------------------------------------------------
/react-motions/src/fadeIn/__tests__/__snapshots__/fadeIn-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`FadeIn should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
12 | FadeIn
13 | ,
14 | Symbol(enzyme.__renderer__): Object {
15 | "batchedUpdates": [Function],
16 | "getNode": [Function],
17 | "render": [Function],
18 | "simulateEvent": [Function],
19 | "unmount": [Function],
20 | },
21 | Symbol(enzyme.__node__): Object {
22 | "instance": null,
23 | "key": undefined,
24 | "nodeType": "host",
25 | "props": Object {
26 | "children": "FadeIn",
27 | "style": Object {
28 | "WebkitAnimationDuration": "1s",
29 | "WebkitAnimationFillMode": "both",
30 | "WebkitAnimationName": "fadeIn",
31 | "animationDuration": "1s",
32 | "animationFillMode": "both",
33 | "animationName": "fadeIn",
34 | },
35 | },
36 | "ref": null,
37 | "rendered": "FadeIn",
38 | "type": "div",
39 | },
40 | Symbol(enzyme.__nodes__): Array [
41 | Object {
42 | "instance": null,
43 | "key": undefined,
44 | "nodeType": "host",
45 | "props": Object {
46 | "children": "FadeIn",
47 | "style": Object {
48 | "WebkitAnimationDuration": "1s",
49 | "WebkitAnimationFillMode": "both",
50 | "WebkitAnimationName": "fadeIn",
51 | "animationDuration": "1s",
52 | "animationFillMode": "both",
53 | "animationName": "fadeIn",
54 | },
55 | },
56 | "ref": null,
57 | "rendered": "FadeIn",
58 | "type": "div",
59 | },
60 | ],
61 | Symbol(enzyme.__options__): Object {
62 | "adapter": ReactSixteenAdapter {
63 | "options": Object {
64 | "enableComponentDidUpdateOnSetState": true,
65 | },
66 | },
67 | },
68 | }
69 | `;
70 |
--------------------------------------------------------------------------------
/react-motions/src/fadeIn/__tests__/__snapshots__/withFadeIn-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`withFadeIn should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
19 |
20 | FadeIn
21 |
22 |
,
23 | Symbol(enzyme.__renderer__): Object {
24 | "batchedUpdates": [Function],
25 | "getNode": [Function],
26 | "render": [Function],
27 | "simulateEvent": [Function],
28 | "unmount": [Function],
29 | },
30 | Symbol(enzyme.__node__): Object {
31 | "instance": null,
32 | "key": undefined,
33 | "nodeType": "host",
34 | "props": Object {
35 | "children":
36 | FadeIn
37 |
,
38 | "style": Object {
39 | "WebkitAnimationDuration": "1s",
40 | "WebkitAnimationFillMode": "both",
41 | "WebkitAnimationName": "fadeIn",
42 | "animationDuration": "1s",
43 | "animationFillMode": "both",
44 | "animationName": "fadeIn",
45 | },
46 | },
47 | "ref": null,
48 | "rendered": Object {
49 | "instance": null,
50 | "key": undefined,
51 | "nodeType": "host",
52 | "props": Object {
53 | "children": "FadeIn",
54 | },
55 | "ref": null,
56 | "rendered": "FadeIn",
57 | "type": "div",
58 | },
59 | "type": "div",
60 | },
61 | Symbol(enzyme.__nodes__): Array [
62 | Object {
63 | "instance": null,
64 | "key": undefined,
65 | "nodeType": "host",
66 | "props": Object {
67 | "children":
68 | FadeIn
69 |
,
70 | "style": Object {
71 | "WebkitAnimationDuration": "1s",
72 | "WebkitAnimationFillMode": "both",
73 | "WebkitAnimationName": "fadeIn",
74 | "animationDuration": "1s",
75 | "animationFillMode": "both",
76 | "animationName": "fadeIn",
77 | },
78 | },
79 | "ref": null,
80 | "rendered": Object {
81 | "instance": null,
82 | "key": undefined,
83 | "nodeType": "host",
84 | "props": Object {
85 | "children": "FadeIn",
86 | },
87 | "ref": null,
88 | "rendered": "FadeIn",
89 | "type": "div",
90 | },
91 | "type": "div",
92 | },
93 | ],
94 | Symbol(enzyme.__options__): Object {
95 | "adapter": ReactSixteenAdapter {
96 | "options": Object {
97 | "enableComponentDidUpdateOnSetState": true,
98 | },
99 | },
100 | },
101 | }
102 | `;
103 |
--------------------------------------------------------------------------------
/react-motions/src/fadeIn/__tests__/fadeIn-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { mount } from 'enzyme';
3 | import FadeIn from '../fadeIn';
4 |
5 | describe('FadeIn', () => {
6 | it('should render', () => {
7 | const wrapper = shallow(FadeIn);
8 |
9 | expect(wrapper).toMatchSnapshot();
10 | });
11 | it('should receive duration prop', () => {
12 | const wrapper = mount(FadeIn);
13 |
14 | expect(wrapper.props().duration).toEqual(3);
15 | });
16 | it('should receive fillMode prop', () => {
17 | const wrapper = mount(FadeIn);
18 | expect(wrapper.props().fillMode).toEqual("both");
19 | });
20 | it('should render correctly when infinite', () => {
21 | const wrapper = mount(FadeIn);
22 |
23 | expect(wrapper.props().infinite).toBe(true);
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/react-motions/src/fadeIn/__tests__/withFadeIn-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import withFadeIn from '../withFadeIn';
3 |
4 | describe('withFadeIn', () => {
5 | it('should render', () => {
6 | const wrapper = shallow(withFadeIn(FadeIn
));
7 |
8 | expect(wrapper).toMatchSnapshot();
9 | });
10 | });
11 |
--------------------------------------------------------------------------------
/react-motions/src/fadeIn/fadeIn.css:
--------------------------------------------------------------------------------
1 | @-webkit-keyframes fadeIn {
2 | from {
3 | opacity: 0;
4 | }
5 |
6 | to {
7 | opacity: 1;
8 | }
9 | }
10 |
11 | @keyframes fadeIn {
12 | from {
13 | opacity: 0;
14 | }
15 |
16 | to {
17 | opacity: 1;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/react-motions/src/fadeIn/fadeIn.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PropTypes from 'prop-types'
3 | import styles from './styles'
4 |
5 | function FadeIn({ children, duration, fillMode, infinite }) {
6 | const style = {
7 | animation: {
8 | WebkitAnimationName: "fadeIn",
9 | animationName: "fadeIn",
10 | WebkitAnimationDuration: `${duration}s`,
11 | animationDuration: `${duration}s`,
12 | WebkitAnimationFillMode: fillMode,
13 | animationFillMode: fillMode
14 | },
15 | infinite: {
16 | WebkitAnimationIterationCount: "infinite",
17 | animationIterationCount: "infinite",
18 | }
19 | }
20 |
21 | const styleComponent = infinite
22 | ? Object.assign(style.animation, style.infinite)
23 | : style.animation
24 |
25 | return (
26 |
27 | {children}
28 |
29 | )
30 | }
31 |
32 | FadeIn.propTypes = {
33 | children: PropTypes.node.isRequired,
34 | duration: PropTypes.number,
35 | fillMode: PropTypes.string,
36 | infinite: PropTypes.bool
37 | }
38 |
39 | FadeIn.defaultProps = {
40 | duration: 1,
41 | fillMode: "both",
42 | infinite: false
43 | }
44 |
45 | export default FadeIn
46 |
--------------------------------------------------------------------------------
/react-motions/src/fadeIn/index.js:
--------------------------------------------------------------------------------
1 | export { default as FadeIn } from './fadeIn'
2 | export { default as withFadeIn } from './withFadeIn'
--------------------------------------------------------------------------------
/react-motions/src/fadeIn/styles.js:
--------------------------------------------------------------------------------
1 | import injectStyles from '../injectStyles'
2 |
3 | export default injectStyles(`
4 | @keyframes fadeIn {
5 | from {
6 | opacity: 0;
7 | }
8 |
9 | to {
10 | opacity: 1;
11 | }
12 | }
13 | `)
14 |
--------------------------------------------------------------------------------
/react-motions/src/fadeIn/withFadeIn.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import styles from './styles'
3 | import memoize from 'fast-memoize'
4 |
5 | function withFadeIn(Component) {
6 | const style = {
7 | WebkitAnimationName: "fadeIn",
8 | animationName: "fadeIn",
9 | WebkitAnimationDuration: "1s",
10 | animationDuration: "1s",
11 | WebkitAnimationFillMode: "both",
12 | animationFillMode: "both"
13 | }
14 |
15 | return (
16 |
17 | {Component}
18 |
19 | )
20 | }
21 |
22 | export default memoize(withFadeIn)
23 |
--------------------------------------------------------------------------------
/react-motions/src/fadeOut/__tests__/__snapshots__/fadeOut-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`FadeOut should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
12 | FadeOut
13 | ,
14 | Symbol(enzyme.__renderer__): Object {
15 | "batchedUpdates": [Function],
16 | "getNode": [Function],
17 | "render": [Function],
18 | "simulateEvent": [Function],
19 | "unmount": [Function],
20 | },
21 | Symbol(enzyme.__node__): Object {
22 | "instance": null,
23 | "key": undefined,
24 | "nodeType": "host",
25 | "props": Object {
26 | "children": "FadeOut",
27 | "style": Object {
28 | "WebkitAnimationDuration": "1s",
29 | "WebkitAnimationFillMode": "both",
30 | "WebkitAnimationName": "fadeOut",
31 | "animationDuration": "1s",
32 | "animationFillMode": "both",
33 | "animationName": "fadeOut",
34 | },
35 | },
36 | "ref": null,
37 | "rendered": "FadeOut",
38 | "type": "div",
39 | },
40 | Symbol(enzyme.__nodes__): Array [
41 | Object {
42 | "instance": null,
43 | "key": undefined,
44 | "nodeType": "host",
45 | "props": Object {
46 | "children": "FadeOut",
47 | "style": Object {
48 | "WebkitAnimationDuration": "1s",
49 | "WebkitAnimationFillMode": "both",
50 | "WebkitAnimationName": "fadeOut",
51 | "animationDuration": "1s",
52 | "animationFillMode": "both",
53 | "animationName": "fadeOut",
54 | },
55 | },
56 | "ref": null,
57 | "rendered": "FadeOut",
58 | "type": "div",
59 | },
60 | ],
61 | Symbol(enzyme.__options__): Object {
62 | "adapter": ReactSixteenAdapter {
63 | "options": Object {
64 | "enableComponentDidUpdateOnSetState": true,
65 | },
66 | },
67 | },
68 | }
69 | `;
70 |
--------------------------------------------------------------------------------
/react-motions/src/fadeOut/__tests__/__snapshots__/withFadeOut-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`withFadeOut should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
19 |
20 | FadeOut
21 |
22 |
,
23 | Symbol(enzyme.__renderer__): Object {
24 | "batchedUpdates": [Function],
25 | "getNode": [Function],
26 | "render": [Function],
27 | "simulateEvent": [Function],
28 | "unmount": [Function],
29 | },
30 | Symbol(enzyme.__node__): Object {
31 | "instance": null,
32 | "key": undefined,
33 | "nodeType": "host",
34 | "props": Object {
35 | "children":
36 | FadeOut
37 |
,
38 | "style": Object {
39 | "WebkitAnimationDuration": "1s",
40 | "WebkitAnimationFillMode": "both",
41 | "WebkitAnimationName": "fadeOut",
42 | "animationDuration": "1s",
43 | "animationFillMode": "both",
44 | "animationName": "fadeOut",
45 | },
46 | },
47 | "ref": null,
48 | "rendered": Object {
49 | "instance": null,
50 | "key": undefined,
51 | "nodeType": "host",
52 | "props": Object {
53 | "children": "FadeOut",
54 | },
55 | "ref": null,
56 | "rendered": "FadeOut",
57 | "type": "div",
58 | },
59 | "type": "div",
60 | },
61 | Symbol(enzyme.__nodes__): Array [
62 | Object {
63 | "instance": null,
64 | "key": undefined,
65 | "nodeType": "host",
66 | "props": Object {
67 | "children":
68 | FadeOut
69 |
,
70 | "style": Object {
71 | "WebkitAnimationDuration": "1s",
72 | "WebkitAnimationFillMode": "both",
73 | "WebkitAnimationName": "fadeOut",
74 | "animationDuration": "1s",
75 | "animationFillMode": "both",
76 | "animationName": "fadeOut",
77 | },
78 | },
79 | "ref": null,
80 | "rendered": Object {
81 | "instance": null,
82 | "key": undefined,
83 | "nodeType": "host",
84 | "props": Object {
85 | "children": "FadeOut",
86 | },
87 | "ref": null,
88 | "rendered": "FadeOut",
89 | "type": "div",
90 | },
91 | "type": "div",
92 | },
93 | ],
94 | Symbol(enzyme.__options__): Object {
95 | "adapter": ReactSixteenAdapter {
96 | "options": Object {
97 | "enableComponentDidUpdateOnSetState": true,
98 | },
99 | },
100 | },
101 | }
102 | `;
103 |
--------------------------------------------------------------------------------
/react-motions/src/fadeOut/__tests__/fadeOut-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { mount } from 'enzyme';
3 | import FadeOut from '../fadeOut';
4 |
5 | describe('FadeOut', () => {
6 | it('should render', () => {
7 | const wrapper = shallow(FadeOut);
8 |
9 | expect(wrapper).toMatchSnapshot();
10 | });
11 | it('should receive duration prop', () => {
12 | const wrapper = mount(FadeOut);
13 |
14 | expect(wrapper.props().duration).toEqual(3);
15 | });
16 | it('should receive fillMode prop', () => {
17 | const wrapper = mount(FadeOut);
18 | expect(wrapper.props().fillMode).toEqual("both");
19 | });
20 | it('should render correctly when infinite', () => {
21 | const wrapper = mount(FadeOut);
22 |
23 | expect(wrapper.props().infinite).toBe(true);
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/react-motions/src/fadeOut/__tests__/withFadeOut-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import withFadeOut from '../withFadeOut';
3 |
4 | describe('withFadeOut', () => {
5 | it('should render', () => {
6 | const wrapper = shallow(withFadeOut(FadeOut
));
7 |
8 | expect(wrapper).toMatchSnapshot();
9 | });
10 | });
11 |
--------------------------------------------------------------------------------
/react-motions/src/fadeOut/fadeOut.css:
--------------------------------------------------------------------------------
1 | @-webkit-keyframes fadeOut {
2 | from {
3 | opacity: 1;
4 | }
5 |
6 | to {
7 | opacity: 0;
8 | }
9 | }
10 |
11 | @keyframes fadeOut {
12 | from {
13 | opacity: 1;
14 | }
15 |
16 | to {
17 | opacity: 0;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/react-motions/src/fadeOut/fadeOut.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PropTypes from 'prop-types'
3 | import styles from './styles'
4 |
5 | function FadeOut({ children, duration, fillMode, infinite }) {
6 | const style = {
7 | animation: {
8 | WebkitAnimationName: "fadeOut",
9 | animationName: "fadeOut",
10 | WebkitAnimationDuration: `${duration}s`,
11 | animationDuration: `${duration}s`,
12 | WebkitAnimationFillMode: fillMode,
13 | animationFillMode: fillMode
14 | },
15 | infinite: {
16 | WebkitAnimationIterationCount: "infinite",
17 | animationIterationCount: "infinite",
18 | }
19 | }
20 |
21 | const styleComponent = infinite
22 | ? Object.assign(style.animation, style.infinite)
23 | : style.animation
24 |
25 | return (
26 |
27 | {children}
28 |
29 | )
30 | }
31 |
32 | FadeOut.propTypes = {
33 | children: PropTypes.node.isRequired,
34 | duration: PropTypes.number,
35 | fillMode: PropTypes.string,
36 | infinite: PropTypes.bool
37 | }
38 |
39 | FadeOut.defaultProps = {
40 | duration: 1,
41 | fillMode: "both",
42 | infinite: false
43 | }
44 |
45 | export default FadeOut
46 |
--------------------------------------------------------------------------------
/react-motions/src/fadeOut/index.js:
--------------------------------------------------------------------------------
1 | export { default as FadeOut } from './fadeOut'
2 | export { default as withFadeOut } from './withFadeOut'
--------------------------------------------------------------------------------
/react-motions/src/fadeOut/styles.js:
--------------------------------------------------------------------------------
1 | import injectStyles from '../injectStyles'
2 |
3 | export default injectStyles(`
4 | @keyframes fadeOut {
5 | from {
6 | opacity: 1;
7 | }
8 |
9 | to {
10 | opacity: 0;
11 | }
12 | }
13 | `)
14 |
--------------------------------------------------------------------------------
/react-motions/src/fadeOut/withFadeOut.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import styles from './styles'
3 | import memoize from 'fast-memoize'
4 |
5 | function withFadeOut(Component) {
6 | const style = {
7 | WebkitAnimationName: "fadeOut",
8 | animationName: "fadeOut",
9 | WebkitAnimationDuration: "1s",
10 | animationDuration: "1s",
11 | WebkitAnimationFillMode: "both",
12 | animationFillMode: "both"
13 | }
14 |
15 | return (
16 |
17 | {Component}
18 |
19 | )
20 | }
21 |
22 | export default memoize(withFadeOut)
23 |
--------------------------------------------------------------------------------
/react-motions/src/flash/__tests__/__snapshots__/flash-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Flash should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
12 | Flash
13 | ,
14 | Symbol(enzyme.__renderer__): Object {
15 | "batchedUpdates": [Function],
16 | "getNode": [Function],
17 | "render": [Function],
18 | "simulateEvent": [Function],
19 | "unmount": [Function],
20 | },
21 | Symbol(enzyme.__node__): Object {
22 | "instance": null,
23 | "key": undefined,
24 | "nodeType": "host",
25 | "props": Object {
26 | "children": "Flash",
27 | "style": Object {
28 | "WebkitAnimationDuration": "1s",
29 | "WebkitAnimationFillMode": "both",
30 | "WebkitAnimationName": "flash",
31 | "animationDuration": "1s",
32 | "animationFillMode": "both",
33 | "animationName": "flash",
34 | },
35 | },
36 | "ref": null,
37 | "rendered": "Flash",
38 | "type": "div",
39 | },
40 | Symbol(enzyme.__nodes__): Array [
41 | Object {
42 | "instance": null,
43 | "key": undefined,
44 | "nodeType": "host",
45 | "props": Object {
46 | "children": "Flash",
47 | "style": Object {
48 | "WebkitAnimationDuration": "1s",
49 | "WebkitAnimationFillMode": "both",
50 | "WebkitAnimationName": "flash",
51 | "animationDuration": "1s",
52 | "animationFillMode": "both",
53 | "animationName": "flash",
54 | },
55 | },
56 | "ref": null,
57 | "rendered": "Flash",
58 | "type": "div",
59 | },
60 | ],
61 | Symbol(enzyme.__options__): Object {
62 | "adapter": ReactSixteenAdapter {
63 | "options": Object {
64 | "enableComponentDidUpdateOnSetState": true,
65 | },
66 | },
67 | },
68 | }
69 | `;
70 |
--------------------------------------------------------------------------------
/react-motions/src/flash/__tests__/__snapshots__/withFlash-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`withFlash should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
19 |
20 | Flash
21 |
22 |
,
23 | Symbol(enzyme.__renderer__): Object {
24 | "batchedUpdates": [Function],
25 | "getNode": [Function],
26 | "render": [Function],
27 | "simulateEvent": [Function],
28 | "unmount": [Function],
29 | },
30 | Symbol(enzyme.__node__): Object {
31 | "instance": null,
32 | "key": undefined,
33 | "nodeType": "host",
34 | "props": Object {
35 | "children":
36 | Flash
37 |
,
38 | "style": Object {
39 | "WebkitAnimationDuration": "1s",
40 | "WebkitAnimationFillMode": "both",
41 | "WebkitAnimationName": "flash",
42 | "animationDuration": "1s",
43 | "animationFillMode": "both",
44 | "animationName": "flash",
45 | },
46 | },
47 | "ref": null,
48 | "rendered": Object {
49 | "instance": null,
50 | "key": undefined,
51 | "nodeType": "host",
52 | "props": Object {
53 | "children": "Flash",
54 | },
55 | "ref": null,
56 | "rendered": "Flash",
57 | "type": "div",
58 | },
59 | "type": "div",
60 | },
61 | Symbol(enzyme.__nodes__): Array [
62 | Object {
63 | "instance": null,
64 | "key": undefined,
65 | "nodeType": "host",
66 | "props": Object {
67 | "children":
68 | Flash
69 |
,
70 | "style": Object {
71 | "WebkitAnimationDuration": "1s",
72 | "WebkitAnimationFillMode": "both",
73 | "WebkitAnimationName": "flash",
74 | "animationDuration": "1s",
75 | "animationFillMode": "both",
76 | "animationName": "flash",
77 | },
78 | },
79 | "ref": null,
80 | "rendered": Object {
81 | "instance": null,
82 | "key": undefined,
83 | "nodeType": "host",
84 | "props": Object {
85 | "children": "Flash",
86 | },
87 | "ref": null,
88 | "rendered": "Flash",
89 | "type": "div",
90 | },
91 | "type": "div",
92 | },
93 | ],
94 | Symbol(enzyme.__options__): Object {
95 | "adapter": ReactSixteenAdapter {
96 | "options": Object {
97 | "enableComponentDidUpdateOnSetState": true,
98 | },
99 | },
100 | },
101 | }
102 | `;
103 |
--------------------------------------------------------------------------------
/react-motions/src/flash/__tests__/flash-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { mount } from 'enzyme';
3 | import Flash from '../flash';
4 |
5 | describe('Flash', () => {
6 | it('should render', () => {
7 | const wrapper = shallow(Flash);
8 |
9 | expect(wrapper).toMatchSnapshot();
10 | });
11 | it('should receive duration prop', () => {
12 | const wrapper = mount(Flash);
13 |
14 | expect(wrapper.props().duration).toEqual(3);
15 | });
16 | it('should receive fillMode prop', () => {
17 | const wrapper = mount(Flash);
18 | expect(wrapper.props().fillMode).toEqual("both");
19 | });
20 | it('should render correctly when infinite', () => {
21 | const wrapper = mount(Flash);
22 |
23 | expect(wrapper.props().infinite).toBe(true);
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/react-motions/src/flash/__tests__/withFlash-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import withFlash from '../withFlash';
3 |
4 | describe('withFlash', () => {
5 | it('should render', () => {
6 | const wrapper = shallow(withFlash(Flash
));
7 |
8 | expect(wrapper).toMatchSnapshot();
9 | });
10 | });
11 |
--------------------------------------------------------------------------------
/react-motions/src/flash/flash.css:
--------------------------------------------------------------------------------
1 | @-webkit-keyframes flash {
2 | from,
3 | 50%,
4 | to {
5 | opacity: 1;
6 | }
7 |
8 | 25%,
9 | 75% {
10 | opacity: 0;
11 | }
12 | }
13 |
14 | @keyframes flash {
15 | from,
16 | 50%,
17 | to {
18 | opacity: 1;
19 | }
20 |
21 | 25%,
22 | 75% {
23 | opacity: 0;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/react-motions/src/flash/flash.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PropTypes from 'prop-types'
3 | import styles from './styles'
4 |
5 | function Flash({ children, duration, fillMode, infinite }) {
6 | const style = {
7 | animation: {
8 | WebkitAnimationName: "flash",
9 | animationName: "flash",
10 | WebkitAnimationDuration: `${duration}s`,
11 | animationDuration: `${duration}s`,
12 | WebkitAnimationFillMode: fillMode,
13 | animationFillMode: fillMode
14 | },
15 | infinite: {
16 | WebkitAnimationIterationCount: "infinite",
17 | animationIterationCount: "infinite",
18 | }
19 | }
20 |
21 | const styleComponent = infinite
22 | ? Object.assign(style.animation, style.infinite)
23 | : style.animation
24 |
25 | return (
26 |
27 | {children}
28 |
29 | )
30 | }
31 |
32 | Flash.propTypes = {
33 | children: PropTypes.node.isRequired,
34 | duration: PropTypes.number,
35 | fillMode: PropTypes.string,
36 | infinite: PropTypes.bool
37 | }
38 |
39 | Flash.defaultProps = {
40 | duration: 1,
41 | fillMode: "both",
42 | infinite: false
43 | }
44 |
45 | export default Flash
46 |
--------------------------------------------------------------------------------
/react-motions/src/flash/index.js:
--------------------------------------------------------------------------------
1 | export { default as Flash } from './flash'
2 | export { default as withFlash } from './withFlash'
--------------------------------------------------------------------------------
/react-motions/src/flash/styles.js:
--------------------------------------------------------------------------------
1 | import injectStyles from '../injectStyles'
2 |
3 | export default injectStyles(`
4 | @keyframes flash {
5 | from,
6 | 50%,
7 | to {
8 | opacity: 1;
9 | }
10 |
11 | 25%,
12 | 75% {
13 | opacity: 0;
14 | }
15 | }
16 | `)
17 |
--------------------------------------------------------------------------------
/react-motions/src/flash/withFlash.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import styles from './styles'
3 | import memoize from 'fast-memoize'
4 |
5 | function withFlash(Component) {
6 | const style = {
7 | WebkitAnimationName: "flash",
8 | animationName: "flash",
9 | WebkitAnimationDuration: "1s",
10 | animationDuration: "1s",
11 | WebkitAnimationFillMode: "both",
12 | animationFillMode: "both"
13 | }
14 |
15 | return (
16 |
17 | {Component}
18 |
19 | )
20 | }
21 |
22 | export default memoize(withFlash)
23 |
--------------------------------------------------------------------------------
/react-motions/src/injectStyles.js:
--------------------------------------------------------------------------------
1 | const injectStyle = (style) => {
2 | const styleElement = document.createElement('style');
3 | let styleSheet = null;
4 |
5 | document.head.appendChild(styleElement);
6 |
7 | styleSheet = styleElement.sheet;
8 | styleSheet.insertRule(style, styleSheet.cssRules.length);
9 | }
10 |
11 | export default injectStyle;
12 |
--------------------------------------------------------------------------------
/react-motions/src/jello/__tests__/__snapshots__/jello-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Jello should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
13 | Jello
14 | ,
15 | Symbol(enzyme.__renderer__): Object {
16 | "batchedUpdates": [Function],
17 | "getNode": [Function],
18 | "render": [Function],
19 | "simulateEvent": [Function],
20 | "unmount": [Function],
21 | },
22 | Symbol(enzyme.__node__): Object {
23 | "instance": null,
24 | "key": undefined,
25 | "nodeType": "host",
26 | "props": Object {
27 | "children": "Jello",
28 | "style": Object {
29 | "WebkitAnimationDuration": "1s",
30 | "WebkitAnimationFillMode": "both",
31 | "WebkitAnimationName": "jello",
32 | "WebkitTransformOrigin": "center",
33 | "animationDuration": "1s",
34 | "animationFillMode": "both",
35 | "animationName": "jello",
36 | "transformOrigin": "center",
37 | },
38 | },
39 | "ref": null,
40 | "rendered": "Jello",
41 | "type": "div",
42 | },
43 | Symbol(enzyme.__nodes__): Array [
44 | Object {
45 | "instance": null,
46 | "key": undefined,
47 | "nodeType": "host",
48 | "props": Object {
49 | "children": "Jello",
50 | "style": Object {
51 | "WebkitAnimationDuration": "1s",
52 | "WebkitAnimationFillMode": "both",
53 | "WebkitAnimationName": "jello",
54 | "WebkitTransformOrigin": "center",
55 | "animationDuration": "1s",
56 | "animationFillMode": "both",
57 | "animationName": "jello",
58 | "transformOrigin": "center",
59 | },
60 | },
61 | "ref": null,
62 | "rendered": "Jello",
63 | "type": "div",
64 | },
65 | ],
66 | Symbol(enzyme.__options__): Object {
67 | "adapter": ReactSixteenAdapter {
68 | "options": Object {
69 | "enableComponentDidUpdateOnSetState": true,
70 | },
71 | },
72 | },
73 | }
74 | `;
75 |
--------------------------------------------------------------------------------
/react-motions/src/jello/__tests__/__snapshots__/withJello-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`withJello should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
21 |
22 | Jello
23 |
24 |
,
25 | Symbol(enzyme.__renderer__): Object {
26 | "batchedUpdates": [Function],
27 | "getNode": [Function],
28 | "render": [Function],
29 | "simulateEvent": [Function],
30 | "unmount": [Function],
31 | },
32 | Symbol(enzyme.__node__): Object {
33 | "instance": null,
34 | "key": undefined,
35 | "nodeType": "host",
36 | "props": Object {
37 | "children":
38 | Jello
39 |
,
40 | "style": Object {
41 | "WebkitAnimationDuration": "1s",
42 | "WebkitAnimationFillMode": "both",
43 | "WebkitAnimationName": "jello",
44 | "WebkitTransformOrigin": "center",
45 | "animationDuration": "1s",
46 | "animationFillMode": "both",
47 | "animationName": "jello",
48 | "transformOrigin": "center",
49 | },
50 | },
51 | "ref": null,
52 | "rendered": Object {
53 | "instance": null,
54 | "key": undefined,
55 | "nodeType": "host",
56 | "props": Object {
57 | "children": "Jello",
58 | },
59 | "ref": null,
60 | "rendered": "Jello",
61 | "type": "div",
62 | },
63 | "type": "div",
64 | },
65 | Symbol(enzyme.__nodes__): Array [
66 | Object {
67 | "instance": null,
68 | "key": undefined,
69 | "nodeType": "host",
70 | "props": Object {
71 | "children":
72 | Jello
73 |
,
74 | "style": Object {
75 | "WebkitAnimationDuration": "1s",
76 | "WebkitAnimationFillMode": "both",
77 | "WebkitAnimationName": "jello",
78 | "WebkitTransformOrigin": "center",
79 | "animationDuration": "1s",
80 | "animationFillMode": "both",
81 | "animationName": "jello",
82 | "transformOrigin": "center",
83 | },
84 | },
85 | "ref": null,
86 | "rendered": Object {
87 | "instance": null,
88 | "key": undefined,
89 | "nodeType": "host",
90 | "props": Object {
91 | "children": "Jello",
92 | },
93 | "ref": null,
94 | "rendered": "Jello",
95 | "type": "div",
96 | },
97 | "type": "div",
98 | },
99 | ],
100 | Symbol(enzyme.__options__): Object {
101 | "adapter": ReactSixteenAdapter {
102 | "options": Object {
103 | "enableComponentDidUpdateOnSetState": true,
104 | },
105 | },
106 | },
107 | }
108 | `;
109 |
--------------------------------------------------------------------------------
/react-motions/src/jello/__tests__/jello-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { mount } from 'enzyme';
3 | import Jello from '../jello';
4 |
5 | describe('Jello', () => {
6 | it('should render', () => {
7 | const wrapper = shallow(Jello);
8 |
9 | expect(wrapper).toMatchSnapshot();
10 | });
11 | it('should receive duration prop', () => {
12 | const wrapper = mount(Jello);
13 |
14 | expect(wrapper.props().duration).toEqual(3);
15 | });
16 | it('should receive fillMode prop', () => {
17 | const wrapper = mount(Jello);
18 | expect(wrapper.props().fillMode).toEqual("both");
19 | });
20 | it('should receive transformOrigin prop', () => {
21 | const wrapper = mount(Jello);
22 | expect(wrapper.props().transformOrigin).toEqual("center");
23 | });
24 | it('should render correctly when infinite', () => {
25 | const wrapper = mount(Jello);
26 |
27 | expect(wrapper.props().infinite).toBe(true);
28 | });
29 | });
30 |
--------------------------------------------------------------------------------
/react-motions/src/jello/__tests__/withJello-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import withJello from '../withJello';
3 |
4 | describe('withJello', () => {
5 | it('should render', () => {
6 | const wrapper = shallow(withJello(Jello
));
7 |
8 | expect(wrapper).toMatchSnapshot();
9 | });
10 | });
11 |
--------------------------------------------------------------------------------
/react-motions/src/jello/index.js:
--------------------------------------------------------------------------------
1 | export { default as Jello } from './jello'
2 | export { default as withJello } from './withJello'
--------------------------------------------------------------------------------
/react-motions/src/jello/jello.css:
--------------------------------------------------------------------------------
1 | @-webkit-keyframes jello {
2 | from,
3 | 11.1%,
4 | to {
5 | -webkit-transform: translate3d(0, 0, 0);
6 | transform: translate3d(0, 0, 0);
7 | }
8 |
9 | 22.2% {
10 | -webkit-transform: skewX(-12.5deg) skewY(-12.5deg);
11 | transform: skewX(-12.5deg) skewY(-12.5deg);
12 | }
13 |
14 | 33.3% {
15 | -webkit-transform: skewX(6.25deg) skewY(6.25deg);
16 | transform: skewX(6.25deg) skewY(6.25deg);
17 | }
18 |
19 | 44.4% {
20 | -webkit-transform: skewX(-3.125deg) skewY(-3.125deg);
21 | transform: skewX(-3.125deg) skewY(-3.125deg);
22 | }
23 |
24 | 55.5% {
25 | -webkit-transform: skewX(1.5625deg) skewY(1.5625deg);
26 | transform: skewX(1.5625deg) skewY(1.5625deg);
27 | }
28 |
29 | 66.6% {
30 | -webkit-transform: skewX(-0.78125deg) skewY(-0.78125deg);
31 | transform: skewX(-0.78125deg) skewY(-0.78125deg);
32 | }
33 |
34 | 77.7% {
35 | -webkit-transform: skewX(0.390625deg) skewY(0.390625deg);
36 | transform: skewX(0.390625deg) skewY(0.390625deg);
37 | }
38 |
39 | 88.8% {
40 | -webkit-transform: skewX(-0.1953125deg) skewY(-0.1953125deg);
41 | transform: skewX(-0.1953125deg) skewY(-0.1953125deg);
42 | }
43 | }
44 |
45 | @keyframes jello {
46 | from,
47 | 11.1%,
48 | to {
49 | -webkit-transform: translate3d(0, 0, 0);
50 | transform: translate3d(0, 0, 0);
51 | }
52 |
53 | 22.2% {
54 | -webkit-transform: skewX(-12.5deg) skewY(-12.5deg);
55 | transform: skewX(-12.5deg) skewY(-12.5deg);
56 | }
57 |
58 | 33.3% {
59 | -webkit-transform: skewX(6.25deg) skewY(6.25deg);
60 | transform: skewX(6.25deg) skewY(6.25deg);
61 | }
62 |
63 | 44.4% {
64 | -webkit-transform: skewX(-3.125deg) skewY(-3.125deg);
65 | transform: skewX(-3.125deg) skewY(-3.125deg);
66 | }
67 |
68 | 55.5% {
69 | -webkit-transform: skewX(1.5625deg) skewY(1.5625deg);
70 | transform: skewX(1.5625deg) skewY(1.5625deg);
71 | }
72 |
73 | 66.6% {
74 | -webkit-transform: skewX(-0.78125deg) skewY(-0.78125deg);
75 | transform: skewX(-0.78125deg) skewY(-0.78125deg);
76 | }
77 |
78 | 77.7% {
79 | -webkit-transform: skewX(0.390625deg) skewY(0.390625deg);
80 | transform: skewX(0.390625deg) skewY(0.390625deg);
81 | }
82 |
83 | 88.8% {
84 | -webkit-transform: skewX(-0.1953125deg) skewY(-0.1953125deg);
85 | transform: skewX(-0.1953125deg) skewY(-0.1953125deg);
86 | }
87 | }
88 |
89 | .jello {
90 | -webkit-animation-name: jello;
91 | animation-name: jello;
92 | -webkit-transform-origin: center;
93 | transform-origin: center;
94 | }
95 |
--------------------------------------------------------------------------------
/react-motions/src/jello/jello.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PropTypes from 'prop-types'
3 | import styles from './styles'
4 |
5 | function Jello({ children, duration, fillMode, infinite, transformOrigin }) {
6 | const style = {
7 | animation: {
8 | WebkitAnimationName: "jello",
9 | animationName: "jello",
10 | WebkitTransformOrigin: transformOrigin,
11 | transformOrigin,
12 | WebkitAnimationDuration: `${duration}s`,
13 | animationDuration: `${duration}s`,
14 | WebkitAnimationFillMode: fillMode,
15 | animationFillMode: fillMode
16 | },
17 | infinite: {
18 | WebkitAnimationIterationCount: "infinite",
19 | animationIterationCount: "infinite",
20 | }
21 | }
22 |
23 | const styleComponent = infinite
24 | ? Object.assign(style.animation, style.infinite)
25 | : style.animation
26 |
27 | return (
28 |
29 | {children}
30 |
31 | )
32 | }
33 |
34 | Jello.propTypes = {
35 | children: PropTypes.node.isRequired,
36 | duration: PropTypes.number,
37 | fillMode: PropTypes.string,
38 | infinite: PropTypes.bool,
39 | transformOrigin: PropTypes.string,
40 | }
41 |
42 | Jello.defaultProps = {
43 | duration: 1,
44 | fillMode: "both",
45 | infinite: false,
46 | transformOrigin: "center"
47 | }
48 |
49 | export default Jello
50 |
--------------------------------------------------------------------------------
/react-motions/src/jello/styles.js:
--------------------------------------------------------------------------------
1 | import injectStyles from '../injectStyles'
2 |
3 | export default injectStyles(`
4 | @keyframes jello {
5 | from,
6 | 11.1%,
7 | to {
8 | -webkit-transform: translate3d(0, 0, 0);
9 | transform: translate3d(0, 0, 0);
10 | }
11 |
12 | 22.2% {
13 | -webkit-transform: skewX(-12.5deg) skewY(-12.5deg);
14 | transform: skewX(-12.5deg) skewY(-12.5deg);
15 | }
16 |
17 | 33.3% {
18 | -webkit-transform: skewX(6.25deg) skewY(6.25deg);
19 | transform: skewX(6.25deg) skewY(6.25deg);
20 | }
21 |
22 | 44.4% {
23 | -webkit-transform: skewX(-3.125deg) skewY(-3.125deg);
24 | transform: skewX(-3.125deg) skewY(-3.125deg);
25 | }
26 |
27 | 55.5% {
28 | -webkit-transform: skewX(1.5625deg) skewY(1.5625deg);
29 | transform: skewX(1.5625deg) skewY(1.5625deg);
30 | }
31 |
32 | 66.6% {
33 | -webkit-transform: skewX(-0.78125deg) skewY(-0.78125deg);
34 | transform: skewX(-0.78125deg) skewY(-0.78125deg);
35 | }
36 |
37 | 77.7% {
38 | -webkit-transform: skewX(0.390625deg) skewY(0.390625deg);
39 | transform: skewX(0.390625deg) skewY(0.390625deg);
40 | }
41 |
42 | 88.8% {
43 | -webkit-transform: skewX(-0.1953125deg) skewY(-0.1953125deg);
44 | transform: skewX(-0.1953125deg) skewY(-0.1953125deg);
45 | }
46 | }
47 | `)
48 |
--------------------------------------------------------------------------------
/react-motions/src/jello/withJello.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import styles from './styles'
3 | import memoize from 'fast-memoize'
4 |
5 | function withJello(Component) {
6 | const style = {
7 | WebkitAnimationName: "jello",
8 | animationName: "jello",
9 | WebkitTransformOrigin: "center",
10 | transformOrigin: "center",
11 | WebkitAnimationDuration: "1s",
12 | animationDuration: "1s",
13 | WebkitAnimationFillMode: "both",
14 | animationFillMode: "both"
15 | }
16 |
17 | return (
18 |
19 | {Component}
20 |
21 | )
22 | }
23 |
24 | export default memoize(withJello)
25 |
--------------------------------------------------------------------------------
/react-motions/src/pulse/__tests__/__snapshots__/pulse-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Pulse should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
12 | Pulse
13 | ,
14 | Symbol(enzyme.__renderer__): Object {
15 | "batchedUpdates": [Function],
16 | "getNode": [Function],
17 | "render": [Function],
18 | "simulateEvent": [Function],
19 | "unmount": [Function],
20 | },
21 | Symbol(enzyme.__node__): Object {
22 | "instance": null,
23 | "key": undefined,
24 | "nodeType": "host",
25 | "props": Object {
26 | "children": "Pulse",
27 | "style": Object {
28 | "WebkitAnimationDuration": "1s",
29 | "WebkitAnimationFillMode": "both",
30 | "WebkitAnimationName": "pulse",
31 | "animationDuration": "1s",
32 | "animationFillMode": "both",
33 | "animationName": "pulse",
34 | },
35 | },
36 | "ref": null,
37 | "rendered": "Pulse",
38 | "type": "div",
39 | },
40 | Symbol(enzyme.__nodes__): Array [
41 | Object {
42 | "instance": null,
43 | "key": undefined,
44 | "nodeType": "host",
45 | "props": Object {
46 | "children": "Pulse",
47 | "style": Object {
48 | "WebkitAnimationDuration": "1s",
49 | "WebkitAnimationFillMode": "both",
50 | "WebkitAnimationName": "pulse",
51 | "animationDuration": "1s",
52 | "animationFillMode": "both",
53 | "animationName": "pulse",
54 | },
55 | },
56 | "ref": null,
57 | "rendered": "Pulse",
58 | "type": "div",
59 | },
60 | ],
61 | Symbol(enzyme.__options__): Object {
62 | "adapter": ReactSixteenAdapter {
63 | "options": Object {
64 | "enableComponentDidUpdateOnSetState": true,
65 | },
66 | },
67 | },
68 | }
69 | `;
70 |
--------------------------------------------------------------------------------
/react-motions/src/pulse/__tests__/__snapshots__/withPulse-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`withPulse should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
19 |
20 | Pulse
21 |
22 |
,
23 | Symbol(enzyme.__renderer__): Object {
24 | "batchedUpdates": [Function],
25 | "getNode": [Function],
26 | "render": [Function],
27 | "simulateEvent": [Function],
28 | "unmount": [Function],
29 | },
30 | Symbol(enzyme.__node__): Object {
31 | "instance": null,
32 | "key": undefined,
33 | "nodeType": "host",
34 | "props": Object {
35 | "children":
36 | Pulse
37 |
,
38 | "style": Object {
39 | "WebkitAnimationDuration": "1s",
40 | "WebkitAnimationFillMode": "both",
41 | "WebkitAnimationName": "pulse",
42 | "animationDuration": "1s",
43 | "animationFillMode": "both",
44 | "animationName": "pulse",
45 | },
46 | },
47 | "ref": null,
48 | "rendered": Object {
49 | "instance": null,
50 | "key": undefined,
51 | "nodeType": "host",
52 | "props": Object {
53 | "children": "Pulse",
54 | },
55 | "ref": null,
56 | "rendered": "Pulse",
57 | "type": "div",
58 | },
59 | "type": "div",
60 | },
61 | Symbol(enzyme.__nodes__): Array [
62 | Object {
63 | "instance": null,
64 | "key": undefined,
65 | "nodeType": "host",
66 | "props": Object {
67 | "children":
68 | Pulse
69 |
,
70 | "style": Object {
71 | "WebkitAnimationDuration": "1s",
72 | "WebkitAnimationFillMode": "both",
73 | "WebkitAnimationName": "pulse",
74 | "animationDuration": "1s",
75 | "animationFillMode": "both",
76 | "animationName": "pulse",
77 | },
78 | },
79 | "ref": null,
80 | "rendered": Object {
81 | "instance": null,
82 | "key": undefined,
83 | "nodeType": "host",
84 | "props": Object {
85 | "children": "Pulse",
86 | },
87 | "ref": null,
88 | "rendered": "Pulse",
89 | "type": "div",
90 | },
91 | "type": "div",
92 | },
93 | ],
94 | Symbol(enzyme.__options__): Object {
95 | "adapter": ReactSixteenAdapter {
96 | "options": Object {
97 | "enableComponentDidUpdateOnSetState": true,
98 | },
99 | },
100 | },
101 | }
102 | `;
103 |
--------------------------------------------------------------------------------
/react-motions/src/pulse/__tests__/pulse-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { mount } from 'enzyme';
3 | import Pulse from '../pulse';
4 |
5 | describe('Pulse', () => {
6 | it('should render', () => {
7 | const wrapper = shallow(Pulse);
8 |
9 | expect(wrapper).toMatchSnapshot();
10 | });
11 | it('should receive duration prop', () => {
12 | const wrapper = mount(Pulse);
13 |
14 | expect(wrapper.props().duration).toEqual(3);
15 | });
16 | it('should receive fillMode prop', () => {
17 | const wrapper = mount(Pulse);
18 | expect(wrapper.props().fillMode).toEqual("both");
19 | });
20 | it('should render correctly when infinite', () => {
21 | const wrapper = mount(Pulse);
22 |
23 | expect(wrapper.props().infinite).toBe(true);
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/react-motions/src/pulse/__tests__/withPulse-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import withPulse from '../withPulse';
3 |
4 | describe('withPulse', () => {
5 | it('should render', () => {
6 | const wrapper = shallow(withPulse(Pulse
));
7 |
8 | expect(wrapper).toMatchSnapshot();
9 | });
10 | });
11 |
--------------------------------------------------------------------------------
/react-motions/src/pulse/index.js:
--------------------------------------------------------------------------------
1 | export { default as Pulse } from './pulse'
2 | export { default as withPulse } from './withPulse'
--------------------------------------------------------------------------------
/react-motions/src/pulse/pulse.css:
--------------------------------------------------------------------------------
1 | /* originally authored by Nick Pettit - https://github.com/nickpettit/glide */
2 |
3 | @-webkit-keyframes pulse {
4 | from {
5 | -webkit-transform: scale3d(1, 1, 1);
6 | transform: scale3d(1, 1, 1);
7 | }
8 |
9 | 50% {
10 | -webkit-transform: scale3d(1.05, 1.05, 1.05);
11 | transform: scale3d(1.05, 1.05, 1.05);
12 | }
13 |
14 | to {
15 | -webkit-transform: scale3d(1, 1, 1);
16 | transform: scale3d(1, 1, 1);
17 | }
18 | }
19 |
20 | @keyframes pulse {
21 | from {
22 | -webkit-transform: scale3d(1, 1, 1);
23 | transform: scale3d(1, 1, 1);
24 | }
25 |
26 | 50% {
27 | -webkit-transform: scale3d(1.05, 1.05, 1.05);
28 | transform: scale3d(1.05, 1.05, 1.05);
29 | }
30 |
31 | to {
32 | -webkit-transform: scale3d(1, 1, 1);
33 | transform: scale3d(1, 1, 1);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/react-motions/src/pulse/pulse.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PropTypes from 'prop-types'
3 | import styles from './styles'
4 |
5 | function Pulse({ children, duration, fillMode, infinite }) {
6 | const style = {
7 | animation: {
8 | WebkitAnimationName: "pulse",
9 | animationName: "pulse",
10 | WebkitAnimationDuration: `${duration}s`,
11 | animationDuration: `${duration}s`,
12 | WebkitAnimationFillMode: fillMode,
13 | animationFillMode: fillMode
14 | },
15 | infinite: {
16 | WebkitAnimationIterationCount: "infinite",
17 | animationIterationCount: "infinite",
18 | }
19 | }
20 |
21 | const styleComponent = infinite
22 | ? Object.assign(style.animation, style.infinite)
23 | : style.animation
24 |
25 | return (
26 |
27 | {children}
28 |
29 | )
30 | }
31 |
32 | Pulse.propTypes = {
33 | children: PropTypes.node.isRequired,
34 | duration: PropTypes.number,
35 | fillMode: PropTypes.string,
36 | infinite: PropTypes.bool
37 | }
38 |
39 | Pulse.defaultProps = {
40 | duration: 1,
41 | fillMode: "both",
42 | infinite: false
43 | }
44 |
45 | export default Pulse
46 |
--------------------------------------------------------------------------------
/react-motions/src/pulse/styles.js:
--------------------------------------------------------------------------------
1 | import injectStyles from '../injectStyles'
2 |
3 | export default injectStyles(`
4 | @keyframes pulse {
5 | from {
6 | -webkit-transform: scale3d(1, 1, 1);
7 | transform: scale3d(1, 1, 1);
8 | }
9 |
10 | 50% {
11 | -webkit-transform: scale3d(1.05, 1.05, 1.05);
12 | transform: scale3d(1.05, 1.05, 1.05);
13 | }
14 |
15 | to {
16 | -webkit-transform: scale3d(1, 1, 1);
17 | transform: scale3d(1, 1, 1);
18 | }
19 | }
20 | `)
21 |
--------------------------------------------------------------------------------
/react-motions/src/pulse/withPulse.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import styles from './styles'
3 | import memoize from 'fast-memoize'
4 |
5 | function withPulse(Component) {
6 | const style = {
7 | WebkitAnimationName: "pulse",
8 | animationName: "pulse",
9 | WebkitAnimationDuration: "1s",
10 | animationDuration: "1s",
11 | WebkitAnimationFillMode: "both",
12 | animationFillMode: "both"
13 | }
14 |
15 | return (
16 |
17 | {Component}
18 |
19 | )
20 | }
21 |
22 | export default memoize(withPulse)
23 |
--------------------------------------------------------------------------------
/react-motions/src/rubberBand/__tests__/__snapshots__/rubberBand-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`RubberBand should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
12 | RubberBand
13 | ,
14 | Symbol(enzyme.__renderer__): Object {
15 | "batchedUpdates": [Function],
16 | "getNode": [Function],
17 | "render": [Function],
18 | "simulateEvent": [Function],
19 | "unmount": [Function],
20 | },
21 | Symbol(enzyme.__node__): Object {
22 | "instance": null,
23 | "key": undefined,
24 | "nodeType": "host",
25 | "props": Object {
26 | "children": "RubberBand",
27 | "style": Object {
28 | "WebkitAnimationDuration": "1s",
29 | "WebkitAnimationFillMode": "both",
30 | "WebkitAnimationName": "rubberBand",
31 | "animationDuration": "1s",
32 | "animationFillMode": "both",
33 | "animationName": "rubberBand",
34 | },
35 | },
36 | "ref": null,
37 | "rendered": "RubberBand",
38 | "type": "div",
39 | },
40 | Symbol(enzyme.__nodes__): Array [
41 | Object {
42 | "instance": null,
43 | "key": undefined,
44 | "nodeType": "host",
45 | "props": Object {
46 | "children": "RubberBand",
47 | "style": Object {
48 | "WebkitAnimationDuration": "1s",
49 | "WebkitAnimationFillMode": "both",
50 | "WebkitAnimationName": "rubberBand",
51 | "animationDuration": "1s",
52 | "animationFillMode": "both",
53 | "animationName": "rubberBand",
54 | },
55 | },
56 | "ref": null,
57 | "rendered": "RubberBand",
58 | "type": "div",
59 | },
60 | ],
61 | Symbol(enzyme.__options__): Object {
62 | "adapter": ReactSixteenAdapter {
63 | "options": Object {
64 | "enableComponentDidUpdateOnSetState": true,
65 | },
66 | },
67 | },
68 | }
69 | `;
70 |
--------------------------------------------------------------------------------
/react-motions/src/rubberBand/__tests__/__snapshots__/withRubberBand-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`withRubberBand should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
19 |
20 | rubberBand
21 |
22 |
,
23 | Symbol(enzyme.__renderer__): Object {
24 | "batchedUpdates": [Function],
25 | "getNode": [Function],
26 | "render": [Function],
27 | "simulateEvent": [Function],
28 | "unmount": [Function],
29 | },
30 | Symbol(enzyme.__node__): Object {
31 | "instance": null,
32 | "key": undefined,
33 | "nodeType": "host",
34 | "props": Object {
35 | "children":
36 | rubberBand
37 |
,
38 | "style": Object {
39 | "WebkitAnimationDuration": "1s",
40 | "WebkitAnimationFillMode": "both",
41 | "WebkitAnimationName": "rubberBand",
42 | "animationDuration": "1s",
43 | "animationFillMode": "both",
44 | "animationName": "rubberBand",
45 | },
46 | },
47 | "ref": null,
48 | "rendered": Object {
49 | "instance": null,
50 | "key": undefined,
51 | "nodeType": "host",
52 | "props": Object {
53 | "children": "rubberBand",
54 | },
55 | "ref": null,
56 | "rendered": "rubberBand",
57 | "type": "div",
58 | },
59 | "type": "div",
60 | },
61 | Symbol(enzyme.__nodes__): Array [
62 | Object {
63 | "instance": null,
64 | "key": undefined,
65 | "nodeType": "host",
66 | "props": Object {
67 | "children":
68 | rubberBand
69 |
,
70 | "style": Object {
71 | "WebkitAnimationDuration": "1s",
72 | "WebkitAnimationFillMode": "both",
73 | "WebkitAnimationName": "rubberBand",
74 | "animationDuration": "1s",
75 | "animationFillMode": "both",
76 | "animationName": "rubberBand",
77 | },
78 | },
79 | "ref": null,
80 | "rendered": Object {
81 | "instance": null,
82 | "key": undefined,
83 | "nodeType": "host",
84 | "props": Object {
85 | "children": "rubberBand",
86 | },
87 | "ref": null,
88 | "rendered": "rubberBand",
89 | "type": "div",
90 | },
91 | "type": "div",
92 | },
93 | ],
94 | Symbol(enzyme.__options__): Object {
95 | "adapter": ReactSixteenAdapter {
96 | "options": Object {
97 | "enableComponentDidUpdateOnSetState": true,
98 | },
99 | },
100 | },
101 | }
102 | `;
103 |
--------------------------------------------------------------------------------
/react-motions/src/rubberBand/__tests__/rubberBand-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { mount } from 'enzyme';
3 | import RubberBand from '../rubberBand';
4 |
5 | describe('RubberBand', () => {
6 | it('should render', () => {
7 | const wrapper = shallow(RubberBand);
8 |
9 | expect(wrapper).toMatchSnapshot();
10 | });
11 | it('should receive duration prop', () => {
12 | const wrapper = mount(RubberBand);
13 |
14 | expect(wrapper.props().duration).toEqual(3);
15 | });
16 | it('should receive fillMode prop', () => {
17 | const wrapper = mount(RubberBand);
18 | expect(wrapper.props().fillMode).toEqual("both");
19 | });
20 | it('should render correctly when infinite', () => {
21 | const wrapper = mount(RubberBand);
22 |
23 | expect(wrapper.props().infinite).toBe(true);
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/react-motions/src/rubberBand/__tests__/withRubberBand-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import withRubberBand from '../withRubberBand';
3 |
4 | describe('withRubberBand', () => {
5 | it('should render', () => {
6 | const wrapper = shallow(withRubberBand(rubberBand
));
7 |
8 | expect(wrapper).toMatchSnapshot();
9 | });
10 | });
11 |
--------------------------------------------------------------------------------
/react-motions/src/rubberBand/index.js:
--------------------------------------------------------------------------------
1 | export { default as RubberBand } from './rubberBand'
2 | export { default as withRubberBand } from './withRubberBand'
--------------------------------------------------------------------------------
/react-motions/src/rubberBand/rubberBand.css:
--------------------------------------------------------------------------------
1 | @-webkit-keyframes rubberBand {
2 | from {
3 | -webkit-transform: scale3d(1, 1, 1);
4 | transform: scale3d(1, 1, 1);
5 | }
6 |
7 | 30% {
8 | -webkit-transform: scale3d(1.25, 0.75, 1);
9 | transform: scale3d(1.25, 0.75, 1);
10 | }
11 |
12 | 40% {
13 | -webkit-transform: scale3d(0.75, 1.25, 1);
14 | transform: scale3d(0.75, 1.25, 1);
15 | }
16 |
17 | 50% {
18 | -webkit-transform: scale3d(1.15, 0.85, 1);
19 | transform: scale3d(1.15, 0.85, 1);
20 | }
21 |
22 | 65% {
23 | -webkit-transform: scale3d(0.95, 1.05, 1);
24 | transform: scale3d(0.95, 1.05, 1);
25 | }
26 |
27 | 75% {
28 | -webkit-transform: scale3d(1.05, 0.95, 1);
29 | transform: scale3d(1.05, 0.95, 1);
30 | }
31 |
32 | to {
33 | -webkit-transform: scale3d(1, 1, 1);
34 | transform: scale3d(1, 1, 1);
35 | }
36 | }
37 |
38 | @keyframes rubberBand {
39 | from {
40 | -webkit-transform: scale3d(1, 1, 1);
41 | transform: scale3d(1, 1, 1);
42 | }
43 |
44 | 30% {
45 | -webkit-transform: scale3d(1.25, 0.75, 1);
46 | transform: scale3d(1.25, 0.75, 1);
47 | }
48 |
49 | 40% {
50 | -webkit-transform: scale3d(0.75, 1.25, 1);
51 | transform: scale3d(0.75, 1.25, 1);
52 | }
53 |
54 | 50% {
55 | -webkit-transform: scale3d(1.15, 0.85, 1);
56 | transform: scale3d(1.15, 0.85, 1);
57 | }
58 |
59 | 65% {
60 | -webkit-transform: scale3d(0.95, 1.05, 1);
61 | transform: scale3d(0.95, 1.05, 1);
62 | }
63 |
64 | 75% {
65 | -webkit-transform: scale3d(1.05, 0.95, 1);
66 | transform: scale3d(1.05, 0.95, 1);
67 | }
68 |
69 | to {
70 | -webkit-transform: scale3d(1, 1, 1);
71 | transform: scale3d(1, 1, 1);
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/react-motions/src/rubberBand/rubberBand.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PropTypes from 'prop-types'
3 | import styles from './styles'
4 |
5 | function RubberBand({ children, duration, fillMode, infinite }) {
6 | const style = {
7 | animation: {
8 | WebkitAnimationName: "rubberBand",
9 | animationName: "rubberBand",
10 | WebkitAnimationDuration: `${duration}s`,
11 | animationDuration: `${duration}s`,
12 | WebkitAnimationFillMode: fillMode,
13 | animationFillMode: fillMode
14 | },
15 | infinite: {
16 | WebkitAnimationIterationCount: "infinite",
17 | animationIterationCount: "infinite",
18 | }
19 | }
20 |
21 | const styleComponent = infinite
22 | ? Object.assign(style.animation, style.infinite)
23 | : style.animation
24 |
25 | return (
26 |
27 | {children}
28 |
29 | )
30 | }
31 |
32 | RubberBand.propTypes = {
33 | children: PropTypes.node.isRequired,
34 | duration: PropTypes.number,
35 | fillMode: PropTypes.string,
36 | infinite: PropTypes.bool
37 | }
38 |
39 | RubberBand.defaultProps = {
40 | duration: 1,
41 | fillMode: "both",
42 | infinite: false
43 | }
44 |
45 | export default RubberBand
46 |
--------------------------------------------------------------------------------
/react-motions/src/rubberBand/styles.js:
--------------------------------------------------------------------------------
1 | import injectStyles from '../injectStyles'
2 |
3 | export default injectStyles(`
4 | @keyframes rubberBand {
5 | from {
6 | -webkit-transform: scale3d(1, 1, 1);
7 | transform: scale3d(1, 1, 1);
8 | }
9 |
10 | 30% {
11 | -webkit-transform: scale3d(1.25, 0.75, 1);
12 | transform: scale3d(1.25, 0.75, 1);
13 | }
14 |
15 | 40% {
16 | -webkit-transform: scale3d(0.75, 1.25, 1);
17 | transform: scale3d(0.75, 1.25, 1);
18 | }
19 |
20 | 50% {
21 | -webkit-transform: scale3d(1.15, 0.85, 1);
22 | transform: scale3d(1.15, 0.85, 1);
23 | }
24 |
25 | 65% {
26 | -webkit-transform: scale3d(0.95, 1.05, 1);
27 | transform: scale3d(0.95, 1.05, 1);
28 | }
29 |
30 | 75% {
31 | -webkit-transform: scale3d(1.05, 0.95, 1);
32 | transform: scale3d(1.05, 0.95, 1);
33 | }
34 |
35 | to {
36 | -webkit-transform: scale3d(1, 1, 1);
37 | transform: scale3d(1, 1, 1);
38 | }
39 | }
40 | `)
41 |
--------------------------------------------------------------------------------
/react-motions/src/rubberBand/withRubberBand.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import styles from './styles'
3 | import memoize from 'fast-memoize'
4 |
5 | function withRubberBand(Component) {
6 | const style = {
7 | WebkitAnimationName: "rubberBand",
8 | animationName: "rubberBand",
9 | WebkitAnimationDuration: "1s",
10 | animationDuration: "1s",
11 | WebkitAnimationFillMode: "both",
12 | animationFillMode: "both"
13 | }
14 |
15 | return (
16 |
17 | {Component}
18 |
19 | )
20 | }
21 |
22 | export default memoize(withRubberBand)
23 |
--------------------------------------------------------------------------------
/react-motions/src/shake/__tests__/__snapshots__/shake-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Shake should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
12 | Shake
13 | ,
14 | Symbol(enzyme.__renderer__): Object {
15 | "batchedUpdates": [Function],
16 | "getNode": [Function],
17 | "render": [Function],
18 | "simulateEvent": [Function],
19 | "unmount": [Function],
20 | },
21 | Symbol(enzyme.__node__): Object {
22 | "instance": null,
23 | "key": undefined,
24 | "nodeType": "host",
25 | "props": Object {
26 | "children": "Shake",
27 | "style": Object {
28 | "WebkitAnimationDuration": "1s",
29 | "WebkitAnimationFillMode": "both",
30 | "WebkitAnimationName": "shake",
31 | "animationDuration": "1s",
32 | "animationFillMode": "both",
33 | "animationName": "shake",
34 | },
35 | },
36 | "ref": null,
37 | "rendered": "Shake",
38 | "type": "div",
39 | },
40 | Symbol(enzyme.__nodes__): Array [
41 | Object {
42 | "instance": null,
43 | "key": undefined,
44 | "nodeType": "host",
45 | "props": Object {
46 | "children": "Shake",
47 | "style": Object {
48 | "WebkitAnimationDuration": "1s",
49 | "WebkitAnimationFillMode": "both",
50 | "WebkitAnimationName": "shake",
51 | "animationDuration": "1s",
52 | "animationFillMode": "both",
53 | "animationName": "shake",
54 | },
55 | },
56 | "ref": null,
57 | "rendered": "Shake",
58 | "type": "div",
59 | },
60 | ],
61 | Symbol(enzyme.__options__): Object {
62 | "adapter": ReactSixteenAdapter {
63 | "options": Object {
64 | "enableComponentDidUpdateOnSetState": true,
65 | },
66 | },
67 | },
68 | }
69 | `;
70 |
--------------------------------------------------------------------------------
/react-motions/src/shake/__tests__/__snapshots__/withShake-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`withShake should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
19 |
20 | Shake
21 |
22 |
,
23 | Symbol(enzyme.__renderer__): Object {
24 | "batchedUpdates": [Function],
25 | "getNode": [Function],
26 | "render": [Function],
27 | "simulateEvent": [Function],
28 | "unmount": [Function],
29 | },
30 | Symbol(enzyme.__node__): Object {
31 | "instance": null,
32 | "key": undefined,
33 | "nodeType": "host",
34 | "props": Object {
35 | "children":
36 | Shake
37 |
,
38 | "style": Object {
39 | "WebkitAnimationDuration": "1s",
40 | "WebkitAnimationFillMode": "both",
41 | "WebkitAnimationName": "shake",
42 | "animationDuration": "1s",
43 | "animationFillMode": "both",
44 | "animationName": "shake",
45 | },
46 | },
47 | "ref": null,
48 | "rendered": Object {
49 | "instance": null,
50 | "key": undefined,
51 | "nodeType": "host",
52 | "props": Object {
53 | "children": "Shake",
54 | },
55 | "ref": null,
56 | "rendered": "Shake",
57 | "type": "div",
58 | },
59 | "type": "div",
60 | },
61 | Symbol(enzyme.__nodes__): Array [
62 | Object {
63 | "instance": null,
64 | "key": undefined,
65 | "nodeType": "host",
66 | "props": Object {
67 | "children":
68 | Shake
69 |
,
70 | "style": Object {
71 | "WebkitAnimationDuration": "1s",
72 | "WebkitAnimationFillMode": "both",
73 | "WebkitAnimationName": "shake",
74 | "animationDuration": "1s",
75 | "animationFillMode": "both",
76 | "animationName": "shake",
77 | },
78 | },
79 | "ref": null,
80 | "rendered": Object {
81 | "instance": null,
82 | "key": undefined,
83 | "nodeType": "host",
84 | "props": Object {
85 | "children": "Shake",
86 | },
87 | "ref": null,
88 | "rendered": "Shake",
89 | "type": "div",
90 | },
91 | "type": "div",
92 | },
93 | ],
94 | Symbol(enzyme.__options__): Object {
95 | "adapter": ReactSixteenAdapter {
96 | "options": Object {
97 | "enableComponentDidUpdateOnSetState": true,
98 | },
99 | },
100 | },
101 | }
102 | `;
103 |
--------------------------------------------------------------------------------
/react-motions/src/shake/__tests__/shake-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { mount } from 'enzyme';
3 | import Shake from '../shake';
4 |
5 | describe('Shake', () => {
6 | it('should render', () => {
7 | const wrapper = shallow(Shake);
8 |
9 | expect(wrapper).toMatchSnapshot();
10 | });
11 | it('should receive duration prop', () => {
12 | const wrapper = mount(Shake);
13 |
14 | expect(wrapper.props().duration).toEqual(3);
15 | });
16 | it('should receive fillMode prop', () => {
17 | const wrapper = mount(Shake);
18 | expect(wrapper.props().fillMode).toEqual("both");
19 | });
20 | it('should render correctly when infinite', () => {
21 | const wrapper = mount(Shake);
22 |
23 | expect(wrapper.props().infinite).toBe(true);
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/react-motions/src/shake/__tests__/withShake-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import withShake from '../withShake';
3 |
4 | describe('withShake', () => {
5 | it('should render', () => {
6 | const wrapper = shallow(withShake(Shake
));
7 |
8 | expect(wrapper).toMatchSnapshot();
9 | });
10 | });
11 |
--------------------------------------------------------------------------------
/react-motions/src/shake/index.js:
--------------------------------------------------------------------------------
1 | export { default as Shake } from './shake'
2 | export { default as withShake } from './withShake'
--------------------------------------------------------------------------------
/react-motions/src/shake/shake.css:
--------------------------------------------------------------------------------
1 | @-webkit-keyframes shake {
2 | from,
3 | to {
4 | -webkit-transform: translate3d(0, 0, 0);
5 | transform: translate3d(0, 0, 0);
6 | }
7 |
8 | 10%,
9 | 30%,
10 | 50%,
11 | 70%,
12 | 90% {
13 | -webkit-transform: translate3d(-10px, 0, 0);
14 | transform: translate3d(-10px, 0, 0);
15 | }
16 |
17 | 20%,
18 | 40%,
19 | 60%,
20 | 80% {
21 | -webkit-transform: translate3d(10px, 0, 0);
22 | transform: translate3d(10px, 0, 0);
23 | }
24 | }
25 |
26 | @keyframes shake {
27 | from,
28 | to {
29 | -webkit-transform: translate3d(0, 0, 0);
30 | transform: translate3d(0, 0, 0);
31 | }
32 |
33 | 10%,
34 | 30%,
35 | 50%,
36 | 70%,
37 | 90% {
38 | -webkit-transform: translate3d(-10px, 0, 0);
39 | transform: translate3d(-10px, 0, 0);
40 | }
41 |
42 | 20%,
43 | 40%,
44 | 60%,
45 | 80% {
46 | -webkit-transform: translate3d(10px, 0, 0);
47 | transform: translate3d(10px, 0, 0);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/react-motions/src/shake/shake.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PropTypes from 'prop-types'
3 | import styles from './styles'
4 |
5 | function Shake({ children, duration, fillMode, infinite }) {
6 | const style = {
7 | animation: {
8 | WebkitAnimationName: "shake",
9 | animationName: "shake",
10 | WebkitAnimationDuration: `${duration}s`,
11 | animationDuration: `${duration}s`,
12 | WebkitAnimationFillMode: fillMode,
13 | animationFillMode: fillMode
14 | },
15 | infinite: {
16 | WebkitAnimationIterationCount: "infinite",
17 | animationIterationCount: "infinite",
18 | }
19 | }
20 |
21 | const styleComponent = infinite
22 | ? Object.assign(style.animation, style.infinite)
23 | : style.animation
24 |
25 | return (
26 |
27 | {children}
28 |
29 | )
30 | }
31 |
32 | Shake.propTypes = {
33 | children: PropTypes.node.isRequired,
34 | duration: PropTypes.number,
35 | fillMode: PropTypes.string,
36 | infinite: PropTypes.bool
37 | }
38 |
39 | Shake.defaultProps = {
40 | duration: 1,
41 | fillMode: "both",
42 | infinite: false
43 | }
44 |
45 | export default Shake
46 |
--------------------------------------------------------------------------------
/react-motions/src/shake/styles.js:
--------------------------------------------------------------------------------
1 | import injectStyles from '../injectStyles'
2 |
3 | export default injectStyles(`
4 | @keyframes shake {
5 | from,
6 | to {
7 | -webkit-transform: translate3d(0, 0, 0);
8 | transform: translate3d(0, 0, 0);
9 | }
10 |
11 | 10%,
12 | 30%,
13 | 50%,
14 | 70%,
15 | 90% {
16 | -webkit-transform: translate3d(-10px, 0, 0);
17 | transform: translate3d(-10px, 0, 0);
18 | }
19 |
20 | 20%,
21 | 40%,
22 | 60%,
23 | 80% {
24 | -webkit-transform: translate3d(10px, 0, 0);
25 | transform: translate3d(10px, 0, 0);
26 | }
27 | }
28 | `)
29 |
--------------------------------------------------------------------------------
/react-motions/src/shake/withShake.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import styles from './styles'
3 | import memoize from 'fast-memoize'
4 |
5 | function withShake(Component) {
6 | const style = {
7 | WebkitAnimationName: "shake",
8 | animationName: "shake",
9 | WebkitAnimationDuration: "1s",
10 | animationDuration: "1s",
11 | WebkitAnimationFillMode: "both",
12 | animationFillMode: "both"
13 | }
14 |
15 | return (
16 |
17 | {Component}
18 |
19 | )
20 | }
21 |
22 | export default memoize(withShake)
23 |
--------------------------------------------------------------------------------
/react-motions/src/swing/__tests__/__snapshots__/swing-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Swing should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
13 | Swing
14 | ,
15 | Symbol(enzyme.__renderer__): Object {
16 | "batchedUpdates": [Function],
17 | "getNode": [Function],
18 | "render": [Function],
19 | "simulateEvent": [Function],
20 | "unmount": [Function],
21 | },
22 | Symbol(enzyme.__node__): Object {
23 | "instance": null,
24 | "key": undefined,
25 | "nodeType": "host",
26 | "props": Object {
27 | "children": "Swing",
28 | "style": Object {
29 | "WebkitAnimationDuration": "1s",
30 | "WebkitAnimationFillMode": "both",
31 | "WebkitAnimationName": "swing",
32 | "WebkitTransformOrigin": "top center",
33 | "animationDuration": "1s",
34 | "animationFillMode": "both",
35 | "animationName": "swing",
36 | "transformOrigin": "top center",
37 | },
38 | },
39 | "ref": null,
40 | "rendered": "Swing",
41 | "type": "div",
42 | },
43 | Symbol(enzyme.__nodes__): Array [
44 | Object {
45 | "instance": null,
46 | "key": undefined,
47 | "nodeType": "host",
48 | "props": Object {
49 | "children": "Swing",
50 | "style": Object {
51 | "WebkitAnimationDuration": "1s",
52 | "WebkitAnimationFillMode": "both",
53 | "WebkitAnimationName": "swing",
54 | "WebkitTransformOrigin": "top center",
55 | "animationDuration": "1s",
56 | "animationFillMode": "both",
57 | "animationName": "swing",
58 | "transformOrigin": "top center",
59 | },
60 | },
61 | "ref": null,
62 | "rendered": "Swing",
63 | "type": "div",
64 | },
65 | ],
66 | Symbol(enzyme.__options__): Object {
67 | "adapter": ReactSixteenAdapter {
68 | "options": Object {
69 | "enableComponentDidUpdateOnSetState": true,
70 | },
71 | },
72 | },
73 | }
74 | `;
75 |
--------------------------------------------------------------------------------
/react-motions/src/swing/__tests__/__snapshots__/withSwing-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`withSwing should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
21 |
22 | Swing
23 |
24 |
,
25 | Symbol(enzyme.__renderer__): Object {
26 | "batchedUpdates": [Function],
27 | "getNode": [Function],
28 | "render": [Function],
29 | "simulateEvent": [Function],
30 | "unmount": [Function],
31 | },
32 | Symbol(enzyme.__node__): Object {
33 | "instance": null,
34 | "key": undefined,
35 | "nodeType": "host",
36 | "props": Object {
37 | "children":
38 | Swing
39 |
,
40 | "style": Object {
41 | "WebkitAnimationDuration": "1s",
42 | "WebkitAnimationFillMode": "both",
43 | "WebkitAnimationName": "swing",
44 | "WebkitTransformOrigin": "top center",
45 | "animationDuration": "1s",
46 | "animationFillMode": "both",
47 | "animationName": "swing",
48 | "transformOrigin": "top center",
49 | },
50 | },
51 | "ref": null,
52 | "rendered": Object {
53 | "instance": null,
54 | "key": undefined,
55 | "nodeType": "host",
56 | "props": Object {
57 | "children": "Swing",
58 | },
59 | "ref": null,
60 | "rendered": "Swing",
61 | "type": "div",
62 | },
63 | "type": "div",
64 | },
65 | Symbol(enzyme.__nodes__): Array [
66 | Object {
67 | "instance": null,
68 | "key": undefined,
69 | "nodeType": "host",
70 | "props": Object {
71 | "children":
72 | Swing
73 |
,
74 | "style": Object {
75 | "WebkitAnimationDuration": "1s",
76 | "WebkitAnimationFillMode": "both",
77 | "WebkitAnimationName": "swing",
78 | "WebkitTransformOrigin": "top center",
79 | "animationDuration": "1s",
80 | "animationFillMode": "both",
81 | "animationName": "swing",
82 | "transformOrigin": "top center",
83 | },
84 | },
85 | "ref": null,
86 | "rendered": Object {
87 | "instance": null,
88 | "key": undefined,
89 | "nodeType": "host",
90 | "props": Object {
91 | "children": "Swing",
92 | },
93 | "ref": null,
94 | "rendered": "Swing",
95 | "type": "div",
96 | },
97 | "type": "div",
98 | },
99 | ],
100 | Symbol(enzyme.__options__): Object {
101 | "adapter": ReactSixteenAdapter {
102 | "options": Object {
103 | "enableComponentDidUpdateOnSetState": true,
104 | },
105 | },
106 | },
107 | }
108 | `;
109 |
--------------------------------------------------------------------------------
/react-motions/src/swing/__tests__/swing-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { mount } from 'enzyme';
3 | import Swing from '../swing';
4 |
5 | describe('Swing', () => {
6 | it('should render', () => {
7 | const wrapper = shallow(Swing);
8 |
9 | expect(wrapper).toMatchSnapshot();
10 | });
11 | it('should receive duration prop', () => {
12 | const wrapper = mount(Swing);
13 |
14 | expect(wrapper.props().duration).toEqual(3);
15 | });
16 | it('should receive fillMode prop', () => {
17 | const wrapper = mount(Swing);
18 | expect(wrapper.props().fillMode).toEqual("both");
19 | });
20 | it('should receive transformOrigin prop', () => {
21 | const wrapper = mount(Swing);
22 | expect(wrapper.props().transformOrigin).toEqual("center");
23 | });
24 | it('should render correctly when infinite', () => {
25 | const wrapper = mount(Swing);
26 |
27 | expect(wrapper.props().infinite).toBe(true);
28 | });
29 | });
30 |
--------------------------------------------------------------------------------
/react-motions/src/swing/__tests__/withSwing-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import withSwing from '../withSwing';
3 |
4 | describe('withSwing', () => {
5 | it('should render', () => {
6 | const wrapper = shallow(withSwing(Swing
));
7 |
8 | expect(wrapper).toMatchSnapshot();
9 | });
10 | });
11 |
--------------------------------------------------------------------------------
/react-motions/src/swing/index.js:
--------------------------------------------------------------------------------
1 | export { default as Swing } from './swing'
2 | export { default as withSwing } from './withSwing'
--------------------------------------------------------------------------------
/react-motions/src/swing/styles.js:
--------------------------------------------------------------------------------
1 | import injectStyles from '../injectStyles'
2 |
3 | export default injectStyles(`
4 | @keyframes swing {
5 | 20% {
6 | -webkit-transform: rotate3d(0, 0, 1, 15deg);
7 | transform: rotate3d(0, 0, 1, 15deg);
8 | }
9 |
10 | 40% {
11 | -webkit-transform: rotate3d(0, 0, 1, -10deg);
12 | transform: rotate3d(0, 0, 1, -10deg);
13 | }
14 |
15 | 60% {
16 | -webkit-transform: rotate3d(0, 0, 1, 5deg);
17 | transform: rotate3d(0, 0, 1, 5deg);
18 | }
19 |
20 | 80% {
21 | -webkit-transform: rotate3d(0, 0, 1, -5deg);
22 | transform: rotate3d(0, 0, 1, -5deg);
23 | }
24 |
25 | to {
26 | -webkit-transform: rotate3d(0, 0, 1, 0deg);
27 | transform: rotate3d(0, 0, 1, 0deg);
28 | }
29 | }
30 | `)
31 |
--------------------------------------------------------------------------------
/react-motions/src/swing/swing.css:
--------------------------------------------------------------------------------
1 | @-webkit-keyframes swing {
2 | 20% {
3 | -webkit-transform: rotate3d(0, 0, 1, 15deg);
4 | transform: rotate3d(0, 0, 1, 15deg);
5 | }
6 |
7 | 40% {
8 | -webkit-transform: rotate3d(0, 0, 1, -10deg);
9 | transform: rotate3d(0, 0, 1, -10deg);
10 | }
11 |
12 | 60% {
13 | -webkit-transform: rotate3d(0, 0, 1, 5deg);
14 | transform: rotate3d(0, 0, 1, 5deg);
15 | }
16 |
17 | 80% {
18 | -webkit-transform: rotate3d(0, 0, 1, -5deg);
19 | transform: rotate3d(0, 0, 1, -5deg);
20 | }
21 |
22 | to {
23 | -webkit-transform: rotate3d(0, 0, 1, 0deg);
24 | transform: rotate3d(0, 0, 1, 0deg);
25 | }
26 | }
27 |
28 | @keyframes swing {
29 | 20% {
30 | -webkit-transform: rotate3d(0, 0, 1, 15deg);
31 | transform: rotate3d(0, 0, 1, 15deg);
32 | }
33 |
34 | 40% {
35 | -webkit-transform: rotate3d(0, 0, 1, -10deg);
36 | transform: rotate3d(0, 0, 1, -10deg);
37 | }
38 |
39 | 60% {
40 | -webkit-transform: rotate3d(0, 0, 1, 5deg);
41 | transform: rotate3d(0, 0, 1, 5deg);
42 | }
43 |
44 | 80% {
45 | -webkit-transform: rotate3d(0, 0, 1, -5deg);
46 | transform: rotate3d(0, 0, 1, -5deg);
47 | }
48 |
49 | to {
50 | -webkit-transform: rotate3d(0, 0, 1, 0deg);
51 | transform: rotate3d(0, 0, 1, 0deg);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/react-motions/src/swing/swing.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PropTypes from 'prop-types'
3 | import styles from './styles'
4 |
5 | function Swing({ children, duration, fillMode, infinite, transformOrigin }) {
6 | const style = {
7 | animation: {
8 | WebkitAnimationName: "swing",
9 | animationName: "swing",
10 | WebkitTransformOrigin: transformOrigin,
11 | transformOrigin,
12 | WebkitAnimationDuration: `${duration}s`,
13 | animationDuration: `${duration}s`,
14 | WebkitAnimationFillMode: fillMode,
15 | animationFillMode: fillMode
16 | },
17 | infinite: {
18 | WebkitAnimationIterationCount: "infinite",
19 | animationIterationCount: "infinite",
20 | }
21 | }
22 |
23 | const styleComponent = infinite
24 | ? Object.assign(style.animation, style.infinite)
25 | : style.animation
26 |
27 | return (
28 |
29 | {children}
30 |
31 | )
32 | }
33 |
34 | Swing.propTypes = {
35 | children: PropTypes.node.isRequired,
36 | duration: PropTypes.number,
37 | fillMode: PropTypes.string,
38 | infinite: PropTypes.bool,
39 | transformOrigin: PropTypes.string,
40 | }
41 |
42 | Swing.defaultProps = {
43 | duration: 1,
44 | fillMode: "both",
45 | infinite: false,
46 | transformOrigin: "top center"
47 | }
48 |
49 | export default Swing
50 |
--------------------------------------------------------------------------------
/react-motions/src/swing/withSwing.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import styles from './styles'
3 | import memoize from 'fast-memoize'
4 |
5 | function withSwing(Component) {
6 | const style = {
7 | WebkitAnimationName: "swing",
8 | animationName: "swing",
9 | WebkitAnimationDuration: "1s",
10 | animationDuration: "1s",
11 | WebkitAnimationFillMode: "both",
12 | animationFillMode: "both",
13 | WebkitTransformOrigin: "top center",
14 | transformOrigin: "top center",
15 | }
16 |
17 | return (
18 |
19 | {Component}
20 |
21 | )
22 | }
23 |
24 | export default memoize(withSwing)
25 |
--------------------------------------------------------------------------------
/react-motions/src/tada/__tests__/__snapshots__/tada-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Tada should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
12 | Tada
13 | ,
14 | Symbol(enzyme.__renderer__): Object {
15 | "batchedUpdates": [Function],
16 | "getNode": [Function],
17 | "render": [Function],
18 | "simulateEvent": [Function],
19 | "unmount": [Function],
20 | },
21 | Symbol(enzyme.__node__): Object {
22 | "instance": null,
23 | "key": undefined,
24 | "nodeType": "host",
25 | "props": Object {
26 | "children": "Tada",
27 | "style": Object {
28 | "WebkitAnimationDuration": "1s",
29 | "WebkitAnimationFillMode": "both",
30 | "WebkitAnimationName": "tada",
31 | "animationDuration": "1s",
32 | "animationFillMode": "both",
33 | "animationName": "tada",
34 | },
35 | },
36 | "ref": null,
37 | "rendered": "Tada",
38 | "type": "div",
39 | },
40 | Symbol(enzyme.__nodes__): Array [
41 | Object {
42 | "instance": null,
43 | "key": undefined,
44 | "nodeType": "host",
45 | "props": Object {
46 | "children": "Tada",
47 | "style": Object {
48 | "WebkitAnimationDuration": "1s",
49 | "WebkitAnimationFillMode": "both",
50 | "WebkitAnimationName": "tada",
51 | "animationDuration": "1s",
52 | "animationFillMode": "both",
53 | "animationName": "tada",
54 | },
55 | },
56 | "ref": null,
57 | "rendered": "Tada",
58 | "type": "div",
59 | },
60 | ],
61 | Symbol(enzyme.__options__): Object {
62 | "adapter": ReactSixteenAdapter {
63 | "options": Object {
64 | "enableComponentDidUpdateOnSetState": true,
65 | },
66 | },
67 | },
68 | }
69 | `;
70 |
--------------------------------------------------------------------------------
/react-motions/src/tada/__tests__/__snapshots__/withTada-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`withTada should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__): ,
23 | Symbol(enzyme.__renderer__): Object {
24 | "batchedUpdates": [Function],
25 | "getNode": [Function],
26 | "render": [Function],
27 | "simulateEvent": [Function],
28 | "unmount": [Function],
29 | },
30 | Symbol(enzyme.__node__): Object {
31 | "instance": null,
32 | "key": undefined,
33 | "nodeType": "host",
34 | "props": Object {
35 | "children":
36 | Tada
37 |
,
38 | "style": Object {
39 | "WebkitAnimationDuration": "1s",
40 | "WebkitAnimationFillMode": "both",
41 | "WebkitAnimationName": "tada",
42 | "animationDuration": "1s",
43 | "animationFillMode": "both",
44 | "animationName": "tada",
45 | },
46 | },
47 | "ref": null,
48 | "rendered": Object {
49 | "instance": null,
50 | "key": undefined,
51 | "nodeType": "host",
52 | "props": Object {
53 | "children": "Tada",
54 | },
55 | "ref": null,
56 | "rendered": "Tada",
57 | "type": "div",
58 | },
59 | "type": "div",
60 | },
61 | Symbol(enzyme.__nodes__): Array [
62 | Object {
63 | "instance": null,
64 | "key": undefined,
65 | "nodeType": "host",
66 | "props": Object {
67 | "children":
68 | Tada
69 |
,
70 | "style": Object {
71 | "WebkitAnimationDuration": "1s",
72 | "WebkitAnimationFillMode": "both",
73 | "WebkitAnimationName": "tada",
74 | "animationDuration": "1s",
75 | "animationFillMode": "both",
76 | "animationName": "tada",
77 | },
78 | },
79 | "ref": null,
80 | "rendered": Object {
81 | "instance": null,
82 | "key": undefined,
83 | "nodeType": "host",
84 | "props": Object {
85 | "children": "Tada",
86 | },
87 | "ref": null,
88 | "rendered": "Tada",
89 | "type": "div",
90 | },
91 | "type": "div",
92 | },
93 | ],
94 | Symbol(enzyme.__options__): Object {
95 | "adapter": ReactSixteenAdapter {
96 | "options": Object {
97 | "enableComponentDidUpdateOnSetState": true,
98 | },
99 | },
100 | },
101 | }
102 | `;
103 |
--------------------------------------------------------------------------------
/react-motions/src/tada/__tests__/tada-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { mount } from 'enzyme';
3 | import Tada from '../tada';
4 |
5 | describe('Tada', () => {
6 | it('should render', () => {
7 | const wrapper = shallow(Tada);
8 |
9 | expect(wrapper).toMatchSnapshot();
10 | });
11 | it('should receive duration prop', () => {
12 | const wrapper = mount(Tada);
13 |
14 | expect(wrapper.props().duration).toEqual(3);
15 | });
16 | it('should receive fillMode prop', () => {
17 | const wrapper = mount(Tada);
18 | expect(wrapper.props().fillMode).toEqual("both");
19 | });
20 | it('should render correctly when infinite', () => {
21 | const wrapper = mount(Tada);
22 |
23 | expect(wrapper.props().infinite).toBe(true);
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/react-motions/src/tada/__tests__/withTada-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import withTada from '../withTada';
3 |
4 | describe('withTada', () => {
5 | it('should render', () => {
6 | const wrapper = shallow(withTada(Tada
));
7 |
8 | expect(wrapper).toMatchSnapshot();
9 | });
10 | });
11 |
--------------------------------------------------------------------------------
/react-motions/src/tada/index.js:
--------------------------------------------------------------------------------
1 | export { default as Tada } from './tada'
2 | export { default as withTada } from './withTada'
--------------------------------------------------------------------------------
/react-motions/src/tada/styles.js:
--------------------------------------------------------------------------------
1 | import injectStyles from '../injectStyles'
2 |
3 | export default injectStyles(`
4 | @keyframes tada {
5 | from {
6 | -webkit-transform: scale3d(1, 1, 1);
7 | transform: scale3d(1, 1, 1);
8 | }
9 |
10 | 10%,
11 | 20% {
12 | -webkit-transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg);
13 | transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg);
14 | }
15 |
16 | 30%,
17 | 50%,
18 | 70%,
19 | 90% {
20 | -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
21 | transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
22 | }
23 |
24 | 40%,
25 | 60%,
26 | 80% {
27 | -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
28 | transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
29 | }
30 |
31 | to {
32 | -webkit-transform: scale3d(1, 1, 1);
33 | transform: scale3d(1, 1, 1);
34 | }
35 | }
36 | `)
37 |
--------------------------------------------------------------------------------
/react-motions/src/tada/tada.css:
--------------------------------------------------------------------------------
1 | @-webkit-keyframes tada {
2 | from {
3 | -webkit-transform: scale3d(1, 1, 1);
4 | transform: scale3d(1, 1, 1);
5 | }
6 |
7 | 10%,
8 | 20% {
9 | -webkit-transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg);
10 | transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg);
11 | }
12 |
13 | 30%,
14 | 50%,
15 | 70%,
16 | 90% {
17 | -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
18 | transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
19 | }
20 |
21 | 40%,
22 | 60%,
23 | 80% {
24 | -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
25 | transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
26 | }
27 |
28 | to {
29 | -webkit-transform: scale3d(1, 1, 1);
30 | transform: scale3d(1, 1, 1);
31 | }
32 | }
33 |
34 | @keyframes tada {
35 | from {
36 | -webkit-transform: scale3d(1, 1, 1);
37 | transform: scale3d(1, 1, 1);
38 | }
39 |
40 | 10%,
41 | 20% {
42 | -webkit-transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg);
43 | transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg);
44 | }
45 |
46 | 30%,
47 | 50%,
48 | 70%,
49 | 90% {
50 | -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
51 | transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
52 | }
53 |
54 | 40%,
55 | 60%,
56 | 80% {
57 | -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
58 | transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
59 | }
60 |
61 | to {
62 | -webkit-transform: scale3d(1, 1, 1);
63 | transform: scale3d(1, 1, 1);
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/react-motions/src/tada/tada.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PropTypes from 'prop-types'
3 | import styles from './styles'
4 |
5 | function Tada({ children, duration, fillMode, infinite }) {
6 | const style = {
7 | animation: {
8 | WebkitAnimationName: "tada",
9 | animationName: "tada",
10 | WebkitAnimationDuration: `${duration}s`,
11 | animationDuration: `${duration}s`,
12 | WebkitAnimationFillMode: fillMode,
13 | animationFillMode: fillMode
14 | },
15 | infinite: {
16 | WebkitAnimationIterationCount: "infinite",
17 | animationIterationCount: "infinite",
18 | }
19 | }
20 |
21 | const styleComponent = infinite
22 | ? Object.assign(style.animation, style.infinite)
23 | : style.animation
24 |
25 | return (
26 |
27 | {children}
28 |
29 | )
30 | }
31 |
32 | Tada.propTypes = {
33 | children: PropTypes.node.isRequired,
34 | duration: PropTypes.number,
35 | fillMode: PropTypes.string,
36 | infinite: PropTypes.bool
37 | }
38 |
39 | Tada.defaultProps = {
40 | duration: 1,
41 | fillMode: "both",
42 | infinite: false
43 | }
44 |
45 | export default Tada
--------------------------------------------------------------------------------
/react-motions/src/tada/withTada.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import styles from './styles'
3 | import memoize from 'fast-memoize'
4 |
5 | function withTada(Component) {
6 | const style = {
7 | WebkitAnimationName: "tada",
8 | animationName: "tada",
9 | WebkitAnimationDuration: "1s",
10 | animationDuration: "1s",
11 | WebkitAnimationFillMode: "both",
12 | animationFillMode: "both"
13 | }
14 |
15 | return (
16 |
17 | {Component}
18 |
19 | )
20 | }
21 |
22 | export default memoize(withTada)
23 |
--------------------------------------------------------------------------------
/react-motions/src/withInfinite.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import memoize from 'fast-memoize'
3 |
4 | // TODO: rewrite it to keep displayName
5 |
6 | const withInfinite = (Component) => {
7 | Component.props.style['WebkitAnimationIterationCount'] = "infinite"
8 | Component.props.style['animationIterationCount'] = "infinite"
9 |
10 | return Component
11 | }
12 |
13 | export default memoize(withInfinite)
14 |
--------------------------------------------------------------------------------
/react-motions/src/wobble/__tests__/__snapshots__/withWobble-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`withWobble should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
19 |
20 | Wobble
21 |
22 |
,
23 | Symbol(enzyme.__renderer__): Object {
24 | "batchedUpdates": [Function],
25 | "getNode": [Function],
26 | "render": [Function],
27 | "simulateEvent": [Function],
28 | "unmount": [Function],
29 | },
30 | Symbol(enzyme.__node__): Object {
31 | "instance": null,
32 | "key": undefined,
33 | "nodeType": "host",
34 | "props": Object {
35 | "children":
36 | Wobble
37 |
,
38 | "style": Object {
39 | "WebkitAnimationDuration": "1s",
40 | "WebkitAnimationFillMode": "both",
41 | "WebkitAnimationName": "wobble",
42 | "animationDuration": "1s",
43 | "animationFillMode": "both",
44 | "animationName": "wobble",
45 | },
46 | },
47 | "ref": null,
48 | "rendered": Object {
49 | "instance": null,
50 | "key": undefined,
51 | "nodeType": "host",
52 | "props": Object {
53 | "children": "Wobble",
54 | },
55 | "ref": null,
56 | "rendered": "Wobble",
57 | "type": "div",
58 | },
59 | "type": "div",
60 | },
61 | Symbol(enzyme.__nodes__): Array [
62 | Object {
63 | "instance": null,
64 | "key": undefined,
65 | "nodeType": "host",
66 | "props": Object {
67 | "children":
68 | Wobble
69 |
,
70 | "style": Object {
71 | "WebkitAnimationDuration": "1s",
72 | "WebkitAnimationFillMode": "both",
73 | "WebkitAnimationName": "wobble",
74 | "animationDuration": "1s",
75 | "animationFillMode": "both",
76 | "animationName": "wobble",
77 | },
78 | },
79 | "ref": null,
80 | "rendered": Object {
81 | "instance": null,
82 | "key": undefined,
83 | "nodeType": "host",
84 | "props": Object {
85 | "children": "Wobble",
86 | },
87 | "ref": null,
88 | "rendered": "Wobble",
89 | "type": "div",
90 | },
91 | "type": "div",
92 | },
93 | ],
94 | Symbol(enzyme.__options__): Object {
95 | "adapter": ReactSixteenAdapter {
96 | "options": Object {
97 | "enableComponentDidUpdateOnSetState": true,
98 | },
99 | },
100 | },
101 | }
102 | `;
103 |
--------------------------------------------------------------------------------
/react-motions/src/wobble/__tests__/__snapshots__/wobble-test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Wobble should render 1`] = `
4 | ShallowWrapper {
5 | "length": 1,
6 | Symbol(enzyme.__root__): [Circular],
7 | Symbol(enzyme.__unrendered__):
12 | Wobble
13 | ,
14 | Symbol(enzyme.__renderer__): Object {
15 | "batchedUpdates": [Function],
16 | "getNode": [Function],
17 | "render": [Function],
18 | "simulateEvent": [Function],
19 | "unmount": [Function],
20 | },
21 | Symbol(enzyme.__node__): Object {
22 | "instance": null,
23 | "key": undefined,
24 | "nodeType": "host",
25 | "props": Object {
26 | "children": "Wobble",
27 | "style": Object {
28 | "WebkitAnimationDuration": "1s",
29 | "WebkitAnimationFillMode": "both",
30 | "WebkitAnimationName": "wobble",
31 | "animationDuration": "1s",
32 | "animationFillMode": "both",
33 | "animationName": "wobble",
34 | },
35 | },
36 | "ref": null,
37 | "rendered": "Wobble",
38 | "type": "div",
39 | },
40 | Symbol(enzyme.__nodes__): Array [
41 | Object {
42 | "instance": null,
43 | "key": undefined,
44 | "nodeType": "host",
45 | "props": Object {
46 | "children": "Wobble",
47 | "style": Object {
48 | "WebkitAnimationDuration": "1s",
49 | "WebkitAnimationFillMode": "both",
50 | "WebkitAnimationName": "wobble",
51 | "animationDuration": "1s",
52 | "animationFillMode": "both",
53 | "animationName": "wobble",
54 | },
55 | },
56 | "ref": null,
57 | "rendered": "Wobble",
58 | "type": "div",
59 | },
60 | ],
61 | Symbol(enzyme.__options__): Object {
62 | "adapter": ReactSixteenAdapter {
63 | "options": Object {
64 | "enableComponentDidUpdateOnSetState": true,
65 | },
66 | },
67 | },
68 | }
69 | `;
70 |
--------------------------------------------------------------------------------
/react-motions/src/wobble/__tests__/withWobble-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import withWobble from '../withWobble';
3 |
4 | describe('withWobble', () => {
5 | it('should render', () => {
6 | const wrapper = shallow(withWobble(Wobble
));
7 |
8 | expect(wrapper).toMatchSnapshot();
9 | });
10 | });
11 |
--------------------------------------------------------------------------------
/react-motions/src/wobble/__tests__/wobble-test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { mount } from 'enzyme';
3 | import Wobble from '../wobble';
4 |
5 | describe('Wobble', () => {
6 | it('should render', () => {
7 | const wrapper = shallow(Wobble);
8 |
9 | expect(wrapper).toMatchSnapshot();
10 | });
11 | it('should receive duration prop', () => {
12 | const wrapper = mount(Wobble);
13 |
14 | expect(wrapper.props().duration).toEqual(3);
15 | });
16 | it('should receive fillMode prop', () => {
17 | const wrapper = mount(Wobble);
18 | expect(wrapper.props().fillMode).toEqual("both");
19 | });
20 | it('should render correctly when infinite', () => {
21 | const wrapper = mount(Wobble);
22 |
23 | expect(wrapper.props().infinite).toBe(true);
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/react-motions/src/wobble/index.js:
--------------------------------------------------------------------------------
1 | export { default as Wobble } from './wobble'
2 | export { default as withWobble } from './withWobble'
--------------------------------------------------------------------------------
/react-motions/src/wobble/styles.js:
--------------------------------------------------------------------------------
1 | import injectStyles from '../injectStyles'
2 |
3 | export default injectStyles(`
4 | @keyframes wobble {
5 | from {
6 | -webkit-transform: translate3d(0, 0, 0);
7 | transform: translate3d(0, 0, 0);
8 | }
9 |
10 | 15% {
11 | -webkit-transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);
12 | transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);
13 | }
14 |
15 | 30% {
16 | -webkit-transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);
17 | transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);
18 | }
19 |
20 | 45% {
21 | -webkit-transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);
22 | transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);
23 | }
24 |
25 | 60% {
26 | -webkit-transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);
27 | transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);
28 | }
29 |
30 | 75% {
31 | -webkit-transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);
32 | transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);
33 | }
34 |
35 | to {
36 | -webkit-transform: translate3d(0, 0, 0);
37 | transform: translate3d(0, 0, 0);
38 | }
39 | }
40 | `)
41 |
--------------------------------------------------------------------------------
/react-motions/src/wobble/withWobble.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import styles from './styles'
3 | import memoize from 'fast-memoize'
4 |
5 | function withWobble(Component) {
6 | const style = {
7 | WebkitAnimationName: "wobble",
8 | animationName: "wobble",
9 | WebkitAnimationDuration: "1s",
10 | animationDuration: "1s",
11 | WebkitAnimationFillMode: "both",
12 | animationFillMode: "both"
13 | }
14 |
15 | return (
16 |
17 | {Component}
18 |
19 | )
20 | }
21 |
22 | export default memoize(withWobble)
23 |
--------------------------------------------------------------------------------
/react-motions/src/wobble/wobble.css:
--------------------------------------------------------------------------------
1 | /* originally authored by Nick Pettit - https://github.com/nickpettit/glide */
2 |
3 | @-webkit-keyframes wobble {
4 | from {
5 | -webkit-transform: translate3d(0, 0, 0);
6 | transform: translate3d(0, 0, 0);
7 | }
8 |
9 | 15% {
10 | -webkit-transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);
11 | transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);
12 | }
13 |
14 | 30% {
15 | -webkit-transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);
16 | transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);
17 | }
18 |
19 | 45% {
20 | -webkit-transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);
21 | transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);
22 | }
23 |
24 | 60% {
25 | -webkit-transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);
26 | transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);
27 | }
28 |
29 | 75% {
30 | -webkit-transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);
31 | transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);
32 | }
33 |
34 | to {
35 | -webkit-transform: translate3d(0, 0, 0);
36 | transform: translate3d(0, 0, 0);
37 | }
38 | }
39 |
40 | @keyframes wobble {
41 | from {
42 | -webkit-transform: translate3d(0, 0, 0);
43 | transform: translate3d(0, 0, 0);
44 | }
45 |
46 | 15% {
47 | -webkit-transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);
48 | transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);
49 | }
50 |
51 | 30% {
52 | -webkit-transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);
53 | transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);
54 | }
55 |
56 | 45% {
57 | -webkit-transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);
58 | transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);
59 | }
60 |
61 | 60% {
62 | -webkit-transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);
63 | transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);
64 | }
65 |
66 | 75% {
67 | -webkit-transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);
68 | transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);
69 | }
70 |
71 | to {
72 | -webkit-transform: translate3d(0, 0, 0);
73 | transform: translate3d(0, 0, 0);
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/react-motions/src/wobble/wobble.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PropTypes from 'prop-types'
3 | import styles from './styles'
4 |
5 | function Wobble({ children, duration, fillMode, infinite }) {
6 | const style = {
7 | animation: {
8 | WebkitAnimationName: "wobble",
9 | animationName: "wobble",
10 | WebkitAnimationDuration: `${duration}s`,
11 | animationDuration: `${duration}s`,
12 | WebkitAnimationFillMode: fillMode,
13 | animationFillMode: fillMode
14 | },
15 | infinite: {
16 | WebkitAnimationIterationCount: "infinite",
17 | animationIterationCount: "infinite",
18 | }
19 | }
20 |
21 | const styleComponent = infinite
22 | ? Object.assign(style.animation, style.infinite)
23 | : style.animation
24 |
25 | return (
26 |
27 | {children}
28 |
29 | )
30 | }
31 |
32 | Wobble.propTypes = {
33 | children: PropTypes.node.isRequired,
34 | duration: PropTypes.number,
35 | fillMode: PropTypes.string,
36 | infinite: PropTypes.bool
37 | }
38 |
39 | Wobble.defaultProps = {
40 | duration: 1,
41 | fillMode: "both",
42 | infinite: false
43 | }
44 |
45 | export default Wobble
--------------------------------------------------------------------------------
/react-motions/webpack.config.babel.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const webpack = require('webpack');
3 |
4 | const sourcePath = path.join(__dirname, 'index.js');
5 |
6 | const config = {
7 | target: 'web',
8 | mode: 'production',
9 | entry: sourcePath,
10 | output: {
11 | path: __dirname,
12 | library: 'react-motions',
13 | libraryTarget: 'umd',
14 | umdNamedDefine: true,
15 | filename: 'react-motions.min.js',
16 | },
17 | externals: {
18 | // Use external version of React
19 | react: {
20 | root: 'React',
21 | commonjs2: 'react',
22 | commonjs: 'react',
23 | amd: 'react'
24 | }
25 | },
26 | resolve: {
27 | extensions: ['.js', '.jsx'],
28 | modules: [
29 | sourcePath,
30 | path.resolve(__dirname, 'node_modules'),
31 | path.resolve(__dirname, '../node_modules')
32 | ],
33 | },
34 | module: {
35 | rules: [
36 | {
37 | test: /\.(js|jsx)$/,
38 | exclude: /node_modules/,
39 | use: ['babel-loader'],
40 | include: [sourcePath, path.join(__dirname, 'src')],
41 | },
42 | ],
43 | },
44 | plugins: [],
45 | optimization: {
46 | minimize: true
47 | }
48 | };
49 |
50 | config.plugins.push(
51 | new webpack.DefinePlugin({
52 | 'process.env.NODE_ENV': JSON.stringify('production'),
53 | })
54 | );
55 | config.plugins.push(new webpack.optimize.ModuleConcatenationPlugin());
56 | config.plugins.push(new webpack.HashedModuleIdsPlugin());
57 |
58 | module.exports = config;
59 |
--------------------------------------------------------------------------------
/test/setup.js:
--------------------------------------------------------------------------------
1 | import Enzyme, { shallow, render, mount } from 'enzyme';
2 | import Adapter from 'enzyme-adapter-react-16';
3 |
4 | // React 16 Enzyme adapter
5 | Enzyme.configure({ adapter: new Adapter() });
6 |
7 | // Make Enzyme functions available in all test files without importing
8 | global.shallow = shallow;
9 | global.render = render;
10 | global.mount = mount;
11 |
--------------------------------------------------------------------------------