-
-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(tooltip): fix controlled open state
- Loading branch information
1 parent
b450499
commit 7891d15
Showing
9 changed files
with
131 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@zag-js/hover-card": patch | ||
"@zag-js/tooltip": patch | ||
--- | ||
|
||
Fix issue where controlled open state could get into an inconsistent machine state during the `opening` or `closing` | ||
state. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"use client" | ||
|
||
import { Tooltip } from "@/components/tooltip" | ||
import { useState } from "react" | ||
|
||
const TooltipDemo = () => { | ||
const [open, setOpen] = useState(false) | ||
return ( | ||
<Tooltip | ||
label="Tooltip Content" | ||
positioning={{ placement: "right" }} | ||
open={open} | ||
onOpenChange={(e) => setOpen(e.open)} | ||
> | ||
<button>Some tooltip</button> | ||
</Tooltip> | ||
) | ||
} | ||
|
||
export default function Page() { | ||
return ( | ||
<div style={{ padding: "40px", height: "200vh" }}> | ||
<h1>Tooltip Controlled (Multiple)</h1> | ||
<div style={{ display: "flex", flexDirection: "column", gap: "4px" }}> | ||
{[...Array.from({ length: 10 })].map((_, index) => ( | ||
<TooltipDemo key={index} /> | ||
))} | ||
</div> | ||
</div> | ||
) | ||
} |