forked from qwikifiers/qwik-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update animations functionality to only support the native popover ap…
…proach (qwikifiers#970) * Change how popover animations work and update docs * fix: modal route not working + naming * fix: modal route not working + naming #2 * fix: p code style * chore: remove unnecessary import * refactor: make compatibility note easier to maintain --------- Co-authored-by: maiieul <[email protected]>
- Loading branch information
Showing
25 changed files
with
384 additions
and
305 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,5 @@ | ||
--- | ||
'@qwik-ui/headless': minor | ||
--- | ||
|
||
We are removing the existing popover animations shimming and instead wil now only support native popover animations. This is considered a breaking change but will be more reliable overall. |
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 |
---|---|---|
|
@@ -2,4 +2,5 @@ node_modules | |
dist | ||
coverage | ||
.eslintrc.* | ||
vite.config.ts | ||
vite.config.ts | ||
packages/kit-headless/browsers/** |
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 |
---|---|---|
|
@@ -7,6 +7,7 @@ on: | |
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
name: Test NodeJS ${{ matrix.node_version }} | ||
|
||
strategy: | ||
matrix: | ||
|
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,49 @@ | ||
import { component$ } from '@builder.io/qwik'; | ||
import { Note, NoteStatus } from '../note/note'; // Adjust the import path based on your structure | ||
|
||
export const TopLayerAnimationsCaveats = component$(() => { | ||
return ( | ||
<Note status={NoteStatus.Warning}> | ||
<strong>Important Caveats for Animating Discrete Properties</strong> | ||
|
||
<ul class="mt-4 list-disc bg-gradient-to-b pl-4"> | ||
<li> | ||
<strong> | ||
Animating <code>display</code> and <code>overlay</code>: | ||
</strong> | ||
<p> | ||
The <code>display</code> property must be included in the transitions list to | ||
ensure the element remains visible throughout the animation. The value flips | ||
from <code>none</code> to <code>block</code> at 0% of the animation, ensuring | ||
visibility for the entire duration. The | ||
<code>overlay</code> ensures the element stays in the top layer until the | ||
animation completes. | ||
</p> | ||
</li> | ||
<li> | ||
<strong> | ||
Using <code>transition-behavior: allow-discrete</code>: | ||
</strong> | ||
<p> | ||
This property is essential when animating discrete properties like{' '} | ||
<code>display</code> and <code>overlay</code>, which are not typically | ||
animatable. It ensures smooth transitions for these discrete properties. | ||
</p> | ||
</li> | ||
<li> | ||
<strong> | ||
Setting Starting Styles with <code>@starting-style</code>: | ||
</strong> | ||
<p> | ||
CSS transitions are only triggered when a property changes on a visible | ||
element. The | ||
<code>@starting-style</code> at-rule allows you to set initial styles (e.g.,{' '} | ||
<code>opacity</code> and | ||
<code>transform</code>) when the element first appears, ensuring that the | ||
animation behaves predictably. | ||
</p> | ||
</li> | ||
</ul> | ||
</Note> | ||
); | ||
}); |
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,22 @@ | ||
import { component$ } from '@builder.io/qwik'; | ||
import { Note, NoteStatus } from '../note/note'; // Adjust the import path based on your structure | ||
|
||
export const BrowserAnimationsCompatability = component$(() => { | ||
return ( | ||
<Note status={NoteStatus.Info}> | ||
<div class="flex flex-col gap-2"> | ||
<h4> | ||
<strong>Browser Compatability</strong> | ||
</h4> | ||
<p> | ||
<a href="https://caniuse.com/?search=popover%20API"> | ||
Browser versions that do not support the popover API natively | ||
</a>{' '} | ||
have known issues when trying to use animations or transitions. If you need to | ||
support legacy versions of browsers, please be sure to test this functionality | ||
independently. | ||
</p> | ||
</div> | ||
</Note> | ||
); | ||
}); |
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
32 changes: 30 additions & 2 deletions
32
apps/website/src/routes/docs/headless/modal/examples/animatable.tsx
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
42 changes: 42 additions & 0 deletions
42
apps/website/src/routes/docs/headless/modal/examples/backdrop-animatable.tsx
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,42 @@ | ||
import { component$, useStyles$ } from '@builder.io/qwik'; | ||
import { Modal, Label } from '@qwik-ui/headless'; | ||
|
||
export default component$(() => { | ||
useStyles$(` | ||
.modal-animation[open]::backdrop { | ||
animation: backdropFadeIn 0.75s ease-in-out forwards; | ||
} | ||
@keyframes backdropFadeIn { | ||
from { | ||
background-color: rgba(0, 0, 0, 0); | ||
} | ||
to { | ||
background-color: rgba(0, 0, 0, 0.65); | ||
} | ||
}`); | ||
|
||
return ( | ||
<Modal.Root> | ||
<Modal.Trigger class="modal-trigger">Open Modal</Modal.Trigger> | ||
<Modal.Panel class="modal-panel modal-animation"> | ||
<Modal.Title>Edit Profile</Modal.Title> | ||
<Modal.Description> | ||
You can update your profile here. Hit the save button when finished. | ||
</Modal.Description> | ||
<Label> | ||
Name | ||
<input type="text" placeholder="John Doe" /> | ||
</Label> | ||
<Label> | ||
<input type="text" placeholder="[email protected]" /> | ||
</Label> | ||
<footer> | ||
<Modal.Close class="modal-close">Cancel</Modal.Close> | ||
<Modal.Close class="modal-close">Save Changes</Modal.Close> | ||
</footer> | ||
</Modal.Panel> | ||
</Modal.Root> | ||
); | ||
}); |
25 changes: 23 additions & 2 deletions
25
apps/website/src/routes/docs/headless/modal/examples/transition.tsx
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
25 changes: 25 additions & 0 deletions
25
apps/website/src/routes/docs/headless/popover/auto-api/api.ts
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,25 @@ | ||
export const api = { | ||
popover: [ | ||
{ | ||
floating: [], | ||
}, | ||
{ | ||
'popover-panel-arrow': [], | ||
}, | ||
{ | ||
'popover-panel-impl': [], | ||
}, | ||
{ | ||
'popover-panel': [], | ||
}, | ||
{ | ||
'popover-root': [], | ||
}, | ||
{ | ||
'popover-trigger': [], | ||
}, | ||
{ | ||
'use-popover': [], | ||
}, | ||
], | ||
}; |
36 changes: 35 additions & 1 deletion
36
apps/website/src/routes/docs/headless/popover/examples/animation.tsx
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
32 changes: 31 additions & 1 deletion
32
apps/website/src/routes/docs/headless/popover/examples/transition.tsx
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
Oops, something went wrong.