Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[popups] actionsRef prop #1236

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7a73a79
[popups] Require Portal part
atomiks Dec 24, 2024
7b415f1
Fix experiment
atomiks Dec 24, 2024
2d41b5e
Remove conditional returns in backdrops
atomiks Dec 24, 2024
9a0860a
[POC] Unmount ref
atomiks Dec 27, 2024
befe34c
ummountRef -> action
atomiks Jan 7, 2025
5a8731f
Merge branch 'master' into fix/js-anim
atomiks Jan 7, 2025
c5b4936
lockfile
atomiks Jan 7, 2025
49bf54c
Merge branch 'master' into fix/js-anim
atomiks Jan 7, 2025
5016515
Merge branch 'master' into fix/js-anim
atomiks Jan 10, 2025
f098d2c
Update
atomiks Jan 10, 2025
a8db50d
Add action for all popups
atomiks Jan 10, 2025
aa84338
Require manual open check
atomiks Jan 10, 2025
154ee1e
Merge branch 'master' into fix/js-anim
atomiks Jan 20, 2025
4fd1541
Fix warning
atomiks Jan 20, 2025
8dc3265
Tests
atomiks Jan 20, 2025
77987ed
Add nativeEvent for mergeReactProps test
atomiks Jan 20, 2025
3c836fb
Lint
atomiks Jan 20, 2025
0af3006
Polish animation page
atomiks Jan 27, 2025
516d53f
Merge branch 'master' into fix/js-anim
atomiks Jan 27, 2025
f190f91
Merge
atomiks Feb 5, 2025
95a1052
Merge
atomiks Feb 5, 2025
6c818ea
proptypes
atomiks Feb 5, 2025
deb808a
Remove stale file
atomiks Feb 5, 2025
45dd76e
Check for params.action
atomiks Feb 5, 2025
1886b8f
Fix Menu test
atomiks Feb 5, 2025
8fcc4ba
Update packages/react/src/menu/root/MenuRoot.test.tsx
atomiks Feb 5, 2025
8678ac1
Rename to actions ref
atomiks Feb 5, 2025
8ddf7f0
Export Actions type
atomiks Feb 5, 2025
b939a3a
Merge
atomiks Feb 6, 2025
6aee360
pnpm-lock
atomiks Feb 6, 2025
1641f5f
Add missing actionsRef tests
atomiks Feb 6, 2025
e69ca40
Merge branch 'master' into fix/js-anim
atomiks Feb 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Polish animation page
  • Loading branch information
atomiks committed Jan 27, 2025
commit 0af3006f1d96816f8335490e1400a7fbe74b0ef1
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ Most components like Popover are unmounted from the DOM when they are closed. To
- Specify `keepMounted` on the `Portal` part
- Use the `render` prop to compose the `Popup` with `motion.div`

```jsx title="animated-popover.tsx" {11-17} "keepMounted"
```jsx title="animated-popover.tsx" {12-18} "keepMounted"
function App() {
const [open, setOpen] = React.useState(false);

return (
<Popover.Root open={open} onOpenChange={setOpen}>
<Popover.Trigger>Trigger</Popover.Trigger>
Expand Down Expand Up @@ -127,9 +128,10 @@ different approach is needed to animate it with Motion.
- Use the `render` prop to compose the `Popup` with `motion.div`
- Animate the properties based on the `open` state, avoiding `AnimatePresence`

```jsx title="animated-select.tsx" {11-19}
```jsx title="animated-select.tsx" {12-20}
function App() {
const [open, setOpen] = React.useState(false);

return (
<Select.Root open={open} onOpenChange={setOpen}>
<Select.Trigger>
Expand Down Expand Up @@ -159,9 +161,9 @@ function App() {

### Manual unmounting

For full control, you can manually unmount the component when it's closed once animations have finished using an `action` passed to the `Root`:
For full control, you can manually unmount the component when it's closed once animations have finished using an `actionRef` passed to the `Root`:

```jsx title="manual-unmount.tsx" "action"
```jsx title="manual-unmount.tsx" "actionRef"
function App() {
const [open, setOpen] = React.useState(false);
const actionRef = React.useRef({ unmount: () => {} });
Expand Down
Loading