Skip to content

Commit b497f1d

Browse files
authored
Merge branch 'main' into fix-3746-animatepresence-strictmode-remount
2 parents f532675 + bbabb00 commit b497f1d

55 files changed

Lines changed: 1585 additions & 234 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,36 @@ Motion adheres to [Semantic Versioning](http://semver.org/).
44

55
Undocumented APIs should be considered internal and may change without warning.
66

7+
## [13.1.0] 2026-08-10
8+
9+
### Added
10+
11+
- `Reorder`: Multidimensional reorder.
12+
- `Reorder`: Automatic axis detection.
13+
- `Reorder`: RTL support.
14+
15+
## [13.0.0] 2026-08-05
16+
17+
### Changed
18+
19+
- Removed optional `@emotion/is-prop-valid` dependency in favour of explicit `<MotionConfig isValidProp={isPropValid}>`.
20+
21+
### Fixed
22+
23+
- Hardware-accelerated SVG elements correctly apply final style on animation complete.
24+
- `AnimatePresence`: Ensure nodes are marked as safe to remove when rendering `propagate` with no `motion` children.
25+
726
## [12.43.0] 2026-07-27
827

928
### Added
1029

1130
- Hardware acceleration for `backgroundColor` in supported browsers.
31+
- Hardware acceleration for SVG elements.
1232

1333
### Fixed
1434

1535
- `AnimatePresence`: Exiting children no longer interleave with entering children, which could reorder and remount children present in both renders.
36+
- `motion`: Throw error when passing a custom `motion` component an incorrect `ref` type.
1637

1738
## [12.42.2] 2026-07-01
1839

‎dev/html/package.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "html-env",
33
"private": true,
4-
"version": "12.42.2",
4+
"version": "13.1.0",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
@@ -10,9 +10,9 @@
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13-
"framer-motion": "^12.42.2",
14-
"motion": "^12.42.2",
15-
"motion-dom": "^12.42.2",
13+
"framer-motion": "^13.1.0",
14+
"motion": "^13.1.0",
15+
"motion-dom": "^13.0.0",
1616
"react": "^18.3.1",
1717
"react-dom": "^18.3.1"
1818
},

‎dev/next/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "next-env",
33
"private": true,
4-
"version": "12.42.2",
4+
"version": "13.1.0",
55
"type": "module",
66
"scripts": {
77
"dev": "next dev",
@@ -10,7 +10,7 @@
1010
"build": "next build"
1111
},
1212
"dependencies": {
13-
"motion": "^12.42.2",
13+
"motion": "^13.1.0",
1414
"next": "15.5.21",
1515
"react": "19.0.0",
1616
"react-dom": "19.0.0"

‎dev/react-19/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-19-env",
33
"private": true,
4-
"version": "12.42.2",
4+
"version": "13.1.0",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
@@ -12,7 +12,7 @@
1212
},
1313
"dependencies": {
1414
"@tanstack/react-virtual": "^3.13.22",
15-
"motion": "^12.42.2",
15+
"motion": "^13.1.0",
1616
"react": "^19.0.0",
1717
"react-dom": "^19.0.0"
1818
},

‎dev/react/package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-env",
33
"private": true,
4-
"version": "12.42.2",
4+
"version": "13.1.0",
55
"type": "module",
66
"scripts": {
77
"dev": "yarn vite",
@@ -13,8 +13,8 @@
1313
"dependencies": {
1414
"@base-ui-components/react": "^1.0.0-rc.0",
1515
"@tanstack/react-virtual": "^3.13.22",
16-
"framer-motion": "^12.42.2",
17-
"motion": "^12.42.2",
16+
"framer-motion": "^13.1.0",
17+
"motion": "^13.1.0",
1818
"react": "^18.3.1",
1919
"react-dom": "^18.3.1"
2020
},
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import { Reorder } from "motion/react"
2+
import { useState } from "react"
3+
4+
interface Item {
5+
id: number
6+
columns: number
7+
}
8+
9+
const initialItems: Item[] = Array.from({ length: 60 }, (_, index) => ({
10+
id: index + 1,
11+
columns: (index % 3) + 1,
12+
}))
13+
14+
export const App = () => {
15+
const [items, setItems] = useState(initialItems)
16+
17+
return (
18+
<main>
19+
<h1>Variable-width reorder flex wrap</h1>
20+
<p>Drag tiles between differently sized wrapped rows.</p>
21+
<Reorder.Group
22+
as="div"
23+
axis="xy"
24+
values={items}
25+
onReorder={setItems}
26+
style={{
27+
display: "flex",
28+
flexWrap: "wrap",
29+
gap: 8,
30+
width: "min(90vw, 840px)",
31+
}}
32+
>
33+
{items.map((item) => (
34+
<Reorder.Item
35+
as="div"
36+
key={item.id}
37+
value={item}
38+
transition={{
39+
type: "spring",
40+
stiffness: 350,
41+
damping: 30,
42+
}}
43+
whileDrag={{
44+
scale: 1.04,
45+
boxShadow: "0 12px 24px rgba(0, 0, 0, 0.2)",
46+
}}
47+
style={{
48+
alignItems: "center",
49+
background: `hsl(${item.id * 17} 75% 85%)`,
50+
borderRadius: 8,
51+
color: "#222",
52+
cursor: "grab",
53+
display: "flex",
54+
flex: `0 0 calc((100% - 88px) / 12 * ${
55+
item.columns
56+
} + ${8 * (item.columns - 1)}px)`,
57+
fontSize: 14,
58+
fontWeight: 600,
59+
height: 56,
60+
justifyContent: "center",
61+
}}
62+
>
63+
{item.id} · {item.columns}×
64+
</Reorder.Item>
65+
))}
66+
</Reorder.Group>
67+
<style>{styles}</style>
68+
</main>
69+
)
70+
}
71+
72+
const styles = `
73+
body {
74+
background: #f2f2f2;
75+
margin: 0;
76+
}
77+
78+
main {
79+
align-items: center;
80+
display: flex;
81+
flex-direction: column;
82+
font-family: sans-serif;
83+
min-height: 100vh;
84+
padding: 32px 0;
85+
}
86+
87+
h1 {
88+
margin: 0;
89+
}
90+
91+
p {
92+
color: #666;
93+
margin: 8px 0 24px;
94+
}
95+
`
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import { Reorder } from "motion/react"
2+
import { useState } from "react"
3+
4+
const initialItems = Array.from({ length: 100 }, (_, index) => index + 1)
5+
6+
export const App = () => {
7+
const [items, setItems] = useState(initialItems)
8+
9+
return (
10+
<main>
11+
<h1>Reorder grid</h1>
12+
<p>Drag any tile to a new position.</p>
13+
<Reorder.Group
14+
as="div"
15+
axis="xy"
16+
values={items}
17+
onReorder={setItems}
18+
style={{
19+
display: "grid",
20+
gap: 8,
21+
gridTemplateColumns: "repeat(10, 1fr)",
22+
width: "min(90vw, 720px)",
23+
}}
24+
>
25+
{items.map((item) => (
26+
<Reorder.Item
27+
as="div"
28+
key={item}
29+
value={item}
30+
transition={{
31+
type: "spring",
32+
stiffness: 350,
33+
damping: 30,
34+
}}
35+
whileDrag={{
36+
scale: 1.08,
37+
boxShadow: "0 12px 24px rgba(0, 0, 0, 0.2)",
38+
}}
39+
style={{
40+
alignItems: "center",
41+
aspectRatio: 1,
42+
background: "#fff",
43+
borderRadius: 8,
44+
color: "#222",
45+
cursor: "grab",
46+
display: "flex",
47+
fontSize: 14,
48+
fontWeight: 600,
49+
justifyContent: "center",
50+
}}
51+
>
52+
{item}
53+
</Reorder.Item>
54+
))}
55+
</Reorder.Group>
56+
<style>{styles}</style>
57+
</main>
58+
)
59+
}
60+
61+
const styles = `
62+
body {
63+
background: #f2f2f2;
64+
margin: 0;
65+
}
66+
67+
main {
68+
align-items: center;
69+
display: flex;
70+
flex-direction: column;
71+
font-family: sans-serif;
72+
min-height: 100vh;
73+
padding: 32px 0;
74+
}
75+
76+
h1 {
77+
margin: 0;
78+
}
79+
80+
p {
81+
color: #666;
82+
margin: 8px 0 24px;
83+
}
84+
`
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { AnimatePresence, motion } from "framer-motion"
2+
import { useState } from "react"
3+
4+
export const App = () => {
5+
const [show, setShow] = useState(true)
6+
const [exitCompleteCount, setExitCompleteCount] = useState(0)
7+
8+
return (
9+
<>
10+
<button id="toggle" onClick={() => setShow(false)}>
11+
Toggle section
12+
</button>
13+
<span id="exit-complete-count">{exitCompleteCount}</span>
14+
<AnimatePresence
15+
onExitComplete={() =>
16+
setExitCompleteCount((count) => count + 1)
17+
}
18+
>
19+
{show && (
20+
<motion.section
21+
id="section"
22+
exit={{ opacity: 0 }}
23+
transition={{ duration: 0.1 }}
24+
>
25+
<AnimatePresence propagate>{null}</AnimatePresence>
26+
</motion.section>
27+
)}
28+
</AnimatePresence>
29+
</>
30+
)
31+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import * as React from "react"
2+
import { useState } from "react"
3+
import { Reorder } from "framer-motion"
4+
5+
type FlexLayout = "row" | "column" | "wrap" | "wrap-rtl"
6+
7+
const initialItems = ["a", "b", "c", "d"]
8+
9+
export const App = () => {
10+
const [items, setItems] = useState(initialItems)
11+
const layout = new URL(window.location.href).searchParams.get(
12+
"layout"
13+
) as FlexLayout
14+
15+
return (
16+
<>
17+
<div data-testid="current-order">{items.join(",")}</div>
18+
<Reorder.Group
19+
as="div"
20+
values={items}
21+
onReorder={setItems}
22+
style={{
23+
display: "flex",
24+
direction: layout === "wrap-rtl" ? "rtl" : "ltr",
25+
flexDirection: layout === "column" ? "column" : "row",
26+
flexWrap: layout.startsWith("wrap") ? "wrap" : "nowrap",
27+
gap: 20,
28+
width: layout.startsWith("wrap") ? 180 : "auto",
29+
}}
30+
>
31+
{items.map((item) => (
32+
<Reorder.Item
33+
as="div"
34+
key={item}
35+
value={item}
36+
data-testid={item}
37+
transition={{ duration: 0 }}
38+
style={{
39+
alignItems: "center",
40+
background: "#eee",
41+
display: "flex",
42+
flex: "0 0 80px",
43+
height: 80,
44+
justifyContent: "center",
45+
}}
46+
>
47+
{item}
48+
</Reorder.Item>
49+
))}
50+
</Reorder.Group>
51+
</>
52+
)
53+
}

0 commit comments

Comments
 (0)