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

feat(preset-mini): add popover-open pseudo variant #3619

Merged
merged 2 commits into from
Mar 14, 2024

Conversation

henrikvilhelmberglund
Copy link
Contributor

@henrikvilhelmberglund henrikvilhelmberglund commented Mar 13, 2024

This PR adds a variant popover-open to add support for the experimental popover-open pseudo class. This can then be used to have two animations, one that plays when the popover is opened and one that is played when it is closed. (and more)

For transitions to work correctly when using opacity and so on support for @starting-style will have to be added somehow: https://developer.mozilla.org/en-US/docs/Web/CSS/@starting-style

fixes #3605

example:
popover-open

<button popovertarget="my-styled-popover">Open styled Popover</button>

<div class="m-0 top-20 p-4 mx-auto animate-[custom-slide-out_0.4s_ease] 
  popover-open:animate-[custom-slide-in_0.4s_ease]
  backdrop:bg-blue-900 transition-all" 
  popover id="my-styled-popover">Greetings, one and all! (styled popover)</div>

custom CSS:

@keyframes custom-slide-in{from{display:block;transform:translate3d(0,-100%,0);opacity:0%}to{transform:translate3d(0,0,0);opacity:100%}}
@keyframes custom-slide-out{from{display:block;transform:translate3d(0,0,0);opacity:100%}to{transform:translate3d(0,-100%,0);opacity:0%}}

Copy link

netlify bot commented Mar 13, 2024

Deploy Preview for unocss ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit b34be6f
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/65f1d742c76bbf0008ab8bda
😎 Deploy Preview https://deploy-preview-3619--unocss.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@antfu antfu added this pull request to the merge queue Mar 14, 2024
Merged via the queue into unocss:main with commit f3944de Mar 14, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Variant popover-open:
2 participants