-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add finalized documentation for how animations should work
- Loading branch information
Showing
19 changed files
with
384 additions
and
276 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': patch | ||
--- | ||
|
||
Add finalized documentation for how animations should work |
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 ImportantAnimationCaveats = 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,68 @@ | ||
import { component$ } from '@builder.io/qwik'; | ||
import { Note, NoteStatus } from '../note/note'; // Adjust the import path based on your structure | ||
import { Badge } from '~/components/ui'; | ||
|
||
export const BrowserAnimationCompatability = component$(() => { | ||
return ( | ||
<Note status={NoteStatus.Info}> | ||
<div class="flex flex-col gap-2"> | ||
<h4> | ||
<strong>Browser Compatability</strong> | ||
</h4> | ||
Browser versions that do not support the popover API natively 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. | ||
<table class="w-full min-w-[540px] text-left sm:min-w-full"> | ||
<thead> | ||
<tr> | ||
<th>Browser</th> | ||
<th>Minimum Version</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>Internet Explorer</td> | ||
<td> | ||
<Badge look="alert" class="w-12 justify-center"> | ||
N/A | ||
</Badge> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Firefox</td> | ||
<td> | ||
<Badge look="primary" class="w-12 justify-center"> | ||
125 | ||
</Badge> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Chrome</td> | ||
<td> | ||
<Badge look="primary" class="w-12 justify-center"> | ||
114 | ||
</Badge> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Safari</td> | ||
<td> | ||
<Badge look="primary" class="w-12 justify-center"> | ||
17 | ||
</Badge> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Edge</td> | ||
<td> | ||
<Badge look="primary" class="w-12 justify-center"> | ||
114 | ||
</Badge> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</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
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
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.