-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: Automatically render popovers as dialogs #7813
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
fedc6b3
feat: Automatically render popovers as dialogs
devongovett 196fb07
Merge branch 'main' of github.com:adobe/react-spectrum into popover-d…
devongovett 2d5c299
remove disableFocusManagement
devongovett 8966735
Merge branch 'main' of github.com:adobe/react-spectrum into popover-d…
devongovett f09ce15
fix example
devongovett 809bcd0
Update account menu and searchable select examples
devongovett 3ff766f
cleanup tests
devongovett File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -39,39 +39,37 @@ import './tailwind.global.css'; | |
``` | ||
|
||
```tsx example standalone | ||
import {DialogTrigger, Button, Popover, Dialog, Menu, MenuItem, Separator, Switch, composeRenderProps} from 'react-aria-components'; | ||
import {MenuTrigger, Button, Popover, Menu, MenuItem, Separator, Switch, composeRenderProps} from 'react-aria-components'; | ||
import type {MenuItemProps, SwitchProps} from 'react-aria-components'; | ||
|
||
function AccountMenuExample() { | ||
return ( | ||
<div className="p-8 bg-gray-50 dark:bg-zinc-900 rounded-lg flex items-start justify-center"> | ||
<DialogTrigger> | ||
<MenuTrigger> | ||
<Button aria-label="Account" className="inline-flex items-center justify-center rounded-md p-1.5 text-white bg-transparent border-none hover:bg-gray-200 pressed:bg-gray-300 dark:hover:bg-zinc-800 dark:pressed:bg-zinc-700 transition-colors cursor-default outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600"> | ||
<img alt="" src="https://i.imgur.com/xIe7Wlb.png" className="w-7 h-7 rounded-full" /> | ||
</Button> | ||
<Popover placement="bottom end" className="p-2 overflow-auto rounded-lg bg-white dark:bg-zinc-950 shadow-lg ring-1 ring-black/10 dark:ring-white/15 entering:animate-in entering:fade-in entering:placement-bottom:slide-in-from-top-1 entering:placement-top:slide-in-from-bottom-1 exiting:animate-out exiting:fade-out exiting:placement-bottom:slide-out-to-top-1 exiting:placement-top:slide-out-to-bottom-1 fill-mode-forwards origin-top-left"> | ||
<Dialog className="outline-hidden"> | ||
<div className="flex gap-2 items-center mx-3 mt-2"> | ||
<img alt="" src="https://i.imgur.com/xIe7Wlb.png" className="w-16 h-16 rounded-full" /> | ||
<div className="flex flex-col gap-1"> | ||
<div className="text-[15px] font-bold text-gray-900 dark:text-gray-100 leading-none">Marissa Whitaker</div> | ||
<div className="text-base text-gray-900 dark:text-gray-100 leading-none mb-1">[email protected]</div> | ||
<MySwitch>Dark Mode</MySwitch> | ||
</div> | ||
<Popover className="p-2 overflow-auto outline-hidden rounded-lg bg-white dark:bg-zinc-950 shadow-lg ring-1 ring-black/10 dark:ring-white/15 entering:animate-in entering:fade-in entering:placement-bottom:slide-in-from-top-1 entering:placement-top:slide-in-from-bottom-1 exiting:animate-out exiting:fade-out exiting:placement-bottom:slide-out-to-top-1 exiting:placement-top:slide-out-to-bottom-1 fill-mode-forwards origin-top-left"> | ||
<div className="flex gap-2 items-center mx-3 mt-2"> | ||
<img alt="" src="https://i.imgur.com/xIe7Wlb.png" className="w-16 h-16 rounded-full" /> | ||
<div className="flex flex-col gap-1"> | ||
<div className="text-[15px] font-bold text-gray-900 dark:text-gray-100 leading-none">Marissa Whitaker</div> | ||
<div className="text-base text-gray-900 dark:text-gray-100 leading-none mb-1">[email protected]</div> | ||
<MySwitch>Dark Mode</MySwitch> | ||
</div> | ||
<Separator className="border-none bg-gray-300 dark:bg-zinc-600 h-[1px] mx-3 mt-4 mb-2" /> | ||
<Menu className="outline-hidden"> | ||
<MyMenuItem id="new">Account Settings</MyMenuItem> | ||
<MyMenuItem id="open">Support</MyMenuItem> | ||
<Separator className="bg-gray-300 dark:bg-zinc-600 h-[1px] mx-3 my-2" /> | ||
<MyMenuItem id="save">Legal notices</MyMenuItem> | ||
<MyMenuItem id="save-as">About</MyMenuItem> | ||
<Separator className="bg-gray-300 dark:bg-zinc-600 h-[1px] mx-3 my-2" /> | ||
<MyMenuItem id="print">Sign out</MyMenuItem> | ||
</Menu> | ||
</Dialog> | ||
</div> | ||
<Separator className="border-none bg-gray-300 dark:bg-zinc-600 h-[1px] mx-3 mt-4 mb-2" /> | ||
<Menu className="outline-hidden"> | ||
<MyMenuItem id="new">Account Settings</MyMenuItem> | ||
<MyMenuItem id="open">Support</MyMenuItem> | ||
<Separator className="bg-gray-300 dark:bg-zinc-600 h-[1px] mx-3 my-2" /> | ||
<MyMenuItem id="save">Legal notices</MyMenuItem> | ||
<MyMenuItem id="save-as">About</MyMenuItem> | ||
<Separator className="bg-gray-300 dark:bg-zinc-600 h-[1px] mx-3 my-2" /> | ||
<MyMenuItem id="print">Sign out</MyMenuItem> | ||
</Menu> | ||
</Popover> | ||
</DialogTrigger> | ||
</MenuTrigger> | ||
</div> | ||
); | ||
} | ||
|
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.