Skip to content

Commit b45f39a

Browse files
authored
fix(docs): upgrade framer-motion (#8586)
* upgrade framer-motion * fixed motion import in docs * fixed easing function * import the easing func is right approach
1 parent e97af2b commit b45f39a

File tree

10 files changed

+63
-23
lines changed

10 files changed

+63
-23
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@
160160
"eslint-plugin-rulesdir": "^0.2.2",
161161
"fast-check": "^2.19.0",
162162
"fast-glob": "^3.1.0",
163-
"framer-motion": "^11.3.0-alpha.0",
164163
"fs-extra": "^11.0.0",
165164
"glob": "^8.0.3",
166165
"glob-promise": "^6.0.5",
@@ -176,6 +175,7 @@
176175
"lfcdn": "^0.4.2",
177176
"lucide-react": "^0.294.0",
178177
"md5": "^2.2.1",
178+
"motion": "^12.23.6",
179179
"npm-cli-login": "^1.0.0",
180180
"nyc": "^10.2.0",
181181
"p-queue": "^6.2.1",

packages/dev/docs/pages/react-aria/home/Styles.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212
import {AddressBar, FileTab, Scrollable, Window} from './components';
13-
import {animate, AnimationPlaybackControls, motion, useMotionValueEvent, useReducedMotion, useScroll, useTransform} from 'framer-motion';
13+
import {animate, AnimationPlaybackControls, motion, useMotionValueEvent, useReducedMotion, useScroll, useTransform} from 'motion/react';
1414
import {
1515
Button,
1616
Collection,

packages/react-aria-components/docs/Button.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ This example uses [Framer Motion](https://www.framer.com/motion/) to create an `
412412
import type {ButtonProps} from 'react-aria-components';
413413
import {ButtonContext, useContextProps} from 'react-aria-components';
414414
import {useButton} from 'react-aria';
415-
import {motion} from 'framer-motion';
415+
import {motion} from 'motion/react';
416416

417417
const AnimatedButton = React.forwardRef((props: ButtonProps, ref: React.ForwardedRef<HTMLButtonElement>) => {
418418
// Merge the local props and ref with the ones provided via context.

packages/react-aria-components/docs/ToggleButton.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ import type {ToggleButtonProps} from 'react-aria-components';
269269
import {ToggleButtonContext, useContextProps} from 'react-aria-components';
270270
import {useToggleState} from 'react-stately';
271271
import {useToggleButton} from 'react-aria';
272-
import {motion} from 'framer-motion';
272+
import {motion} from 'motion/react';
273273

274274
const AnimatedToggleButton = React.forwardRef((props: ToggleButtonProps, ref: React.ForwardedRef<HTMLButtonElement>) => {
275275
// Merge the local props and ref with the ones provided via context.

packages/react-aria-components/docs/examples/framer-modal-sheet.mdx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ import {
5757
useMotionTemplate,
5858
useMotionValue,
5959
useTransform,
60-
useMotionValueEvent
61-
} from 'framer-motion';
60+
useMotionValueEvent,
61+
cubicBezier
62+
} from 'motion/react';
6263
import {
6364
Dialog,
6465
ModalOverlay,
@@ -68,7 +69,7 @@ import {
6869
} from 'react-aria-components';
6970
import { useState } from 'react';
7071

71-
// Wrap React Aria modal components so they support framer-motion values.
72+
// Wrap React Aria modal components so they support motion values.
7273
const MotionModal = motion(Modal);
7374
const MotionModalOverlay = motion(ModalOverlay);
7475

@@ -81,7 +82,7 @@ const inertiaTransition = {
8182

8283
const staticTransition = {
8384
duration: 0.5,
84-
ease: [0.32, 0.72, 0, 1]
85+
ease: cubicBezier(0.32, 0.72, 0, 1)
8586
};
8687

8788
const SHEET_MARGIN = 34;

packages/react-aria-components/docs/examples/ios-list.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ import {
128128
useIsPresent,
129129
useMotionTemplate,
130130
useMotionValueEvent
131-
} from "framer-motion";
131+
} from "motion/react";
132132
import { useRef, useState } from "react";
133133
import type {CSSProperties} from 'react';
134134

packages/react-aria-components/docs/examples/swipeable-tabs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ import {
5252
TabPanel,
5353
Collection
5454
} from "react-aria-components";
55-
import { motion, animate, useScroll, useTransform, useMotionValueEvent } from "framer-motion";
55+
import { motion, animate, useScroll, useTransform, useMotionValueEvent } from "motion/react";
5656
import { useCallback, useEffect, useRef, useState } from "react";
5757

5858
let tabs = [

packages/react-aria-components/docs/styling.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ If you are using Tailwind CSS, we recommend using the [tailwindcss-animate](http
354354

355355
```tsx
356356
import {Modal, ModalOverlay} from 'react-aria-components';
357-
import {motion} from 'framer-motion';
357+
import {motion} from 'motion/react';
358358

359359
// Create Framer Motion wrappers.
360360
const MotionModal = motion(Modal);
@@ -424,7 +424,7 @@ The [AnimatePresence](https://www.framer.com/motion/animate-presence/) component
424424

425425
```tsx
426426
import {GridList, GridListItem} from 'react-aria-components';
427-
import {motion, AnimatePresence} from 'framer-motion';
427+
import {motion, AnimatePresence} from 'motion/react';
428428

429429
const MotionItem = motion(GridListItem);
430430

scripts/buildWebsite.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async function build() {
5353
name.startsWith('postcss') ||
5454
name === 'sharp' ||
5555
name === 'recast' ||
56-
name === 'framer-motion' ||
56+
name === 'motion' ||
5757
name === 'tailwindcss-animate' ||
5858
name === 'tailwindcss' ||
5959
name === '@tailwindcss/postcss' ||
@@ -82,7 +82,7 @@ async function build() {
8282
// Add a public url if provided via arg (for verdaccio prod doc website build since we want a commit hash)
8383
build: `DOCS_ENV=production PARCEL_WORKER_BACKEND=process GIT_HASH=${gitHash} parcel build 'docs/*/*/docs/*.mdx' 'docs/react-aria-components/docs/**/*.mdx' 'packages/dev/docs/pages/**/*.mdx' ${publicUrlFlag}`,
8484
postinstall: 'patch-package',
85-
createRssFeed: "node scripts/createFeed.mjs"
85+
createRssFeed: 'node scripts/createFeed.mjs'
8686
},
8787
'@parcel/transformer-css': packageJSON['@parcel/transformer-css'],
8888
'@parcel/resolver-default': {
@@ -174,8 +174,8 @@ async function build() {
174174

175175
// Copy the build back into dist, and delete the temp dir.
176176
fs.copySync(path.join(dir, 'dist'), path.join(__dirname, '..', 'dist', 'production', 'docs'));
177-
fs.copySync(path.join(dir, 'scripts', 'releases-feed.rss'), path.join(__dirname, '..', 'dist', 'production', 'docs', 'releases', 'releases-feed.rss'))
178-
fs.copySync(path.join(dir, 'scripts', 'blog-feed.rss'), path.join(__dirname, '..', 'dist', 'production', 'docs', 'blog', 'blog-feed.rss'))
177+
fs.copySync(path.join(dir, 'scripts', 'releases-feed.rss'), path.join(__dirname, '..', 'dist', 'production', 'docs', 'releases', 'releases-feed.rss'));
178+
fs.copySync(path.join(dir, 'scripts', 'blog-feed.rss'), path.join(__dirname, '..', 'dist', 'production', 'docs', 'blog', 'blog-feed.rss'));
179179
fs.removeSync(dir);
180180
}
181181

yarn.lock

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16970,23 +16970,25 @@ __metadata:
1697016970
languageName: node
1697116971
linkType: hard
1697216972

16973-
"framer-motion@npm:^11.3.0-alpha.0":
16974-
version: 11.3.0-alpha.0
16975-
resolution: "framer-motion@npm:11.3.0-alpha.0"
16973+
"framer-motion@npm:^12.23.6":
16974+
version: 12.23.6
16975+
resolution: "framer-motion@npm:12.23.6"
1697616976
dependencies:
16977+
motion-dom: "npm:^12.23.6"
16978+
motion-utils: "npm:^12.23.6"
1697716979
tslib: "npm:^2.4.0"
1697816980
peerDependencies:
1697916981
"@emotion/is-prop-valid": "*"
16980-
react: ^18.0.0
16981-
react-dom: ^18.0.0
16982+
react: ^18.0.0 || ^19.0.0
16983+
react-dom: ^18.0.0 || ^19.0.0
1698216984
peerDependenciesMeta:
1698316985
"@emotion/is-prop-valid":
1698416986
optional: true
1698516987
react:
1698616988
optional: true
1698716989
react-dom:
1698816990
optional: true
16989-
checksum: 10c0/9ae2dab7ebfcaf2f4c1e277094b07f8ed405ce38055665937eddaaac1f70749234dd1500beeaa5cd3582373f2e1ea78fd7b07beb359066bf7085a2eb177bf4f3
16991+
checksum: 10c0/4bb30b6a39cb3a0cd70a103fa8c321c751d2d308253fb84c3ed3c97ac7278cbd2b66e8b76207f540f2760d024d516e50f7038c15ba63f42c9184d8dab02d7478
1699016992
languageName: node
1699116993
linkType: hard
1699216994

@@ -23309,6 +23311,43 @@ __metadata:
2330923311
languageName: node
2331023312
linkType: hard
2331123313

23314+
"motion-dom@npm:^12.23.6":
23315+
version: 12.23.6
23316+
resolution: "motion-dom@npm:12.23.6"
23317+
dependencies:
23318+
motion-utils: "npm:^12.23.6"
23319+
checksum: 10c0/4f4c5e9fcabdad6e3523c71f1e23bd0cb50a71e362a02d1897dfd30f85b044c88ccf62d506dfa35388b035d4073714b9ad021c70c858eab7d6c2227908ee18cc
23320+
languageName: node
23321+
linkType: hard
23322+
23323+
"motion-utils@npm:^12.23.6":
23324+
version: 12.23.6
23325+
resolution: "motion-utils@npm:12.23.6"
23326+
checksum: 10c0/c058e8ba6423b3baa63e985bcc669877ee7d9579d938f5348b4e60c5ea1b4b33dd7f4877434436a4a5807f3cf00370d3fd4079a6fdd6309c5c87aa62b311a897
23327+
languageName: node
23328+
linkType: hard
23329+
23330+
"motion@npm:^12.23.6":
23331+
version: 12.23.6
23332+
resolution: "motion@npm:12.23.6"
23333+
dependencies:
23334+
framer-motion: "npm:^12.23.6"
23335+
tslib: "npm:^2.4.0"
23336+
peerDependencies:
23337+
"@emotion/is-prop-valid": "*"
23338+
react: ^18.0.0 || ^19.0.0
23339+
react-dom: ^18.0.0 || ^19.0.0
23340+
peerDependenciesMeta:
23341+
"@emotion/is-prop-valid":
23342+
optional: true
23343+
react:
23344+
optional: true
23345+
react-dom:
23346+
optional: true
23347+
checksum: 10c0/f0475a7b5e9b54919c45ce7e4a40bbeb46cdc84358e6c80c40ad797fe6d0bbbb83958c2d8f5522a7a4fb83d1f3ceddfa20505fa96b07ea2133bb9b60377f9cd7
23348+
languageName: node
23349+
linkType: hard
23350+
2331223351
"move-concurrently@npm:^1.0.1":
2331323352
version: 1.0.1
2331423353
resolution: "move-concurrently@npm:1.0.1"
@@ -26210,7 +26249,6 @@ __metadata:
2621026249
eslint-plugin-rulesdir: "npm:^0.2.2"
2621126250
fast-check: "npm:^2.19.0"
2621226251
fast-glob: "npm:^3.1.0"
26213-
framer-motion: "npm:^11.3.0-alpha.0"
2621426252
fs-extra: "npm:^11.0.0"
2621526253
glob: "npm:^8.0.3"
2621626254
glob-promise: "npm:^6.0.5"
@@ -26226,6 +26264,7 @@ __metadata:
2622626264
lfcdn: "npm:^0.4.2"
2622726265
lucide-react: "npm:^0.294.0"
2622826266
md5: "npm:^2.2.1"
26267+
motion: "npm:^12.23.6"
2622926268
npm-cli-login: "npm:^1.0.0"
2623026269
nyc: "npm:^10.2.0"
2623126270
p-queue: "npm:^6.2.1"

0 commit comments

Comments
 (0)