feat(modal): dispatch transitionend event

This commit is contained in:
Eric Liu 2021-02-03 10:25:29 -08:00
commit cbea1df97a
6 changed files with 52 additions and 25 deletions

View file

@ -1,4 +1,8 @@
<script>
/**
* @event {{ open: boolean; }} transitionend
*/
/**
* Set the size of the composed modal
* @type {"xs" | "sm" | "lg"}
@ -102,8 +106,11 @@
on:mouseover
on:mouseenter
on:mouseleave
on:transitionend
on:transitionend="{({ currentTarget }) => {
on:transitionend="{({ propertyName, currentTarget }) => {
if (propertyName === 'transform') {
dispatch('transitionend', { open });
}
if (didOpen) {
focus(currentTarget);
didOpen = false;

View file

@ -1,4 +1,8 @@
<script>
/**
* @event {{ open: boolean; }} transitionend
*/
/**
* Set the size of the modal
* @type {"xs" | "sm" | "lg"}
@ -151,6 +155,11 @@
on:mouseover
on:mouseenter
on:mouseleave
on:transitionend="{(e) => {
if (e.propertyName === 'transform') {
dispatch('transitionend', { open });
}
}}"
>
<div
bind:this="{innerModal}"