Skip to content

Commit c453fe1

Browse files
committed
Merge branch 'motion/integration' of github.com:razorpay/blade into motion/integration
2 parents 4053b62 + 6a8497d commit c453fe1

File tree

6 files changed

+21
-23
lines changed

6 files changed

+21
-23
lines changed

packages/blade/docs/guides/Installation.stories.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Before you install the package, make sure that you have performed the following
9393
<Text>Blade has a few peer dependencies that you may already have installed in your project. If so, you can skip adding them again.</Text>
9494

9595
```shell
96-
yarn add @razorpay/blade styled-components@5.3.11 @razorpay/i18nify-js@1.9.3 @razorpay/i18nify-react@4.0.8 motion@11.12.0
96+
yarn add @razorpay/blade styled-components@5.3.11 @razorpay/i18nify-js@1.9.3 @razorpay/i18nify-react@4.0.8 framer-motion@11.13.3
9797
```
9898
<List>
9999
<ListItem>
@@ -255,7 +255,7 @@ Before you install the package, make sure that you have performed the following
255255
<TabPanel value="motion">
256256
<Heading size="large" marginTop="spacing.7">Add motion to your application</Heading>
257257

258-
Assuming you've followed the first step and installed `motion` in your project, Here's how we recommend you to setup the project-
258+
Assuming you've followed the first step and installed `framer-motion` in your project, Here's how we recommend you to setup the project-
259259

260260
<MotionInstallation />
261261

packages/blade/docs/migration-docs/upgrade-v12.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ We've changed the structure of motion easing tokens inorder to simplify the stru
88

99
2. Motion React Setup
1010

11-
Blade v12 introduces `motion` (prev `framer-motion`) as peer dependency and requires you to set it up in your projects.
11+
Blade v12 introduces `framer-motion` as peer dependency and requires you to set it up in your projects.
1212

1313
## Steps to Migrate
1414

1515
- **Step 1:** Upgrade to latest `@razorpay/blade` package in your project
1616
- **Step 2:** [Perform Tokens Changes](#token-changes) using Codemod or manually
17-
- **Step 3:** [Setup `motion/react` (or `framer-motion`)](#motion-react-framer-motion-setup)
17+
- **Step 3:** [Setup framer-motion](#motion-react-framer-motion-setup)
1818

1919
## Token Changes
2020

@@ -47,7 +47,7 @@ You can skip this if you've run the codemod but in case not or you see some edge
4747
4848
> [!IMPORTANT]
4949
>
50-
> `framer-motion` library is now known as `motion/react`
50+
> `framer-motion` library is now known as `motion/react`. We still use `framer-motion` imports in blade to support older versions.
5151
>
5252
> Checkout the [announcement by creator of framer-motion](https://bsky.app/profile/citizenofnowhe.re/post/3lar365ouuk2v)
5353
@@ -59,10 +59,10 @@ You can skip this if you've run the codemod but in case not or you see some edge
5959
We realised that several projects in razorpay are already using `framer-motion` and are on older versions.
6060
To give some time to consumers to upgrade to framer-motion v11+, we'll be supporting framer-motion v4+ from blade. Although we will be dropping this support in next major version of blade so we recommend planning out framer-motion upgrade in coming quarter.
6161
62-
- **If you're on React 18**, migrating to framer-motion v11 should be fairly simple and low-effort. Checkout [Migrating from framer-motion v4+ to motion/react v11+](#migrating-from-framer-motion-v4-to-motionreact-aka-framer-motion-v11)
62+
- **If you're on React 18**, migrating to framer-motion v11 should be fairly simple and low-effort. Checkout [Migrating from framer-motion v4+ to framer-motion v11+](#migrating-from-framer-motion-v4-to-motionreact-aka-framer-motion-v11)
6363
- **For projects not on React 18 yet**, do plan out the upgrade soon to make sure future blade upgrades don't become blocker
6464
65-
#### Migrating from `framer-motion` v4+ to `motion/react` (aka `framer-motion` v11)
65+
#### Migrating from `framer-motion` v4+ to `framer-motion` v11+
6666
6767
1. Ensure you're on React 18 as `framer-motion` v7 makes React 18 a minimum supported version.
6868
a. [Checkout React 18 upgrade guide](https://react.dev/blog/2022/03/08/react-18-upgrade-guide) or use [React's official codemod for upgrading](https://github.com/reactjs/react-codemod)
@@ -75,35 +75,34 @@ These are mostly the changes you'll need if you're using core API. But if you're
7575
7676
### Setting Up Motion in New Projects
7777
78-
- #### Install `motion`
78+
- #### Install `framer-motion`
7979
8080
```sh
81-
yarn add motion --dev # or pnpm install motion --save-dev
81+
yarn add framer-motion@^11 --dev # or pnpm install framer-motion --save-dev
8282
```
8383
84-
- #### Setup reduced bundle version of `motion/react
84+
- #### Setup reduced bundle version of `framer-motion`
8585
8686
##### If you're only using basic presets like `Fade`, `Move`, `Slide`, `Stagger`, `AnimateInteractions`, etc
8787
8888
```ts
8989
// features.js
90-
import { domAnimation } from 'motion/react';
90+
import { domAnimation } from 'framer-motion';
9191
export default domAnimation; // ~15kb
9292
```
9393
9494
##### If you're using `Morph` or Layout animations of Motion React
9595
9696
```ts
9797
// features.js
98-
import { domMax } from 'motion/react';
98+
import { domMax } from 'framer-motion';
9999
export default domMax; // ~25kb (This includes domAnimation bundle as well so no need to import domAnimation again)
100100
```
101101
102102
##### Lazy load into your App.js
103103
104104
```tsx
105-
import { LazyMotion } from 'motion/react';
106-
import { m } from 'motion';
105+
import { LazyMotion, m } from 'framer-motion';
107106
108107
// Make sure to return the specific export containing the feature bundle.
109108
const loadFeatures = () => import('./features.js').then((res) => res.default);

packages/blade/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@
294294
"react-dom": ">=18",
295295
"styled-components": "^5",
296296
"framer-motion": ">=4",
297-
"motion": ">=11.12.0",
298297
"react-native": "^0.72",
299298
"@floating-ui/react-native": "^0.10.0",
300299
"react-native-reanimated": "^3.4.1",

packages/blade/rollup.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const nativeExtensions = [
5151
const packageJsonDeps = Object.keys(packagejson.dependencies).filter(
5252
(name) => name !== 'patch-package',
5353
);
54+
5455
const externalDependencies = packageJsonDeps;
5556

5657
const inputRootDirectory = 'src';

packages/blade/src/components/BaseMotion/docs/MotionInstallation.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,22 @@ This setup is taken from [Motion React - Reduce Bundle Size Docs](https://motion
66

77
```ts
88
// features.js
9-
import { domAnimation } from 'motion/react';
9+
import { domAnimation } from 'framer-motion';
1010
export default domAnimation; // ~15kb
1111
```
1212

1313
#### If you're using `Morph` or Layout animations of Motion React
1414

1515
```ts
1616
// features.js
17-
import { domMax } from 'motion/react';
17+
import { domMax } from 'framer-motion';
1818
export default domMax; // ~25kb (This includes domAnimation bundle as well so no need to import domAnimation again)
1919
```
2020

2121
### 2. Lazy load into your App.js
2222

2323
```tsx
24-
import { LazyMotion } from 'motion/react';
25-
import { m } from 'motion';
24+
import { LazyMotion, m } from 'framer-motion';
2625

2726
// Make sure to return the specific export containing the feature bundle.
2827
const loadFeatures = () => import('./features.js').then((res) => res.default);

packages/blade/src/utils/storybook/Sandbox/baseCode.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const getReactScriptsJSDependencies = (): Dependencies => {
5959
react: '^18',
6060
'react-dom': '^18',
6161
'react-scripts': '4.0.3',
62-
motion: '11.12.0',
62+
'framer-motion': '11.13.3',
6363
'@razorpay/blade': getBladeVersion(),
6464
'styled-components': packageJson.peerDependencies['styled-components'],
6565
'@razorpay/i18nify-js': packageJson.peerDependencies['@razorpay/i18nify-js'],
@@ -74,7 +74,7 @@ export const getViteReactTSDependencies = (): Dependencies => {
7474
react: '^19',
7575
'react-dom': '^19',
7676
'react-router-dom': '^6',
77-
motion: '11.12.0',
77+
'framer-motion': '11.13.3',
7878
'react-scripts': '4.0.3',
7979
'@types/react': '^19',
8080
'@types/react-dom': '^19',
@@ -107,7 +107,7 @@ export const vitePackageJSON = JSON.stringify(
107107
);
108108

109109
export const featuresJS = dedent`// features.js
110-
import { domMax } from 'motion/react';
110+
import { domMax } from 'framer-motion';
111111
// ~25kb (Only expose domAnimations instead of domMax if you're not using Morph preset or layout animations in your project)
112112
export default domMax;
113113
`;
@@ -262,7 +262,7 @@ export const getIndexTSX = ({
262262
import React from 'react';
263263
import { createRoot } from "react-dom/client";
264264
import { createGlobalStyle } from "styled-components";
265-
import { LazyMotion } from 'motion/react';
265+
import { LazyMotion } from 'framer-motion';
266266
267267
const loadFeatures = () => import('./features.js').then((res) => res.default);
268268

0 commit comments

Comments
 (0)