Skip to content

Commit 14a3c57

Browse files
committed
Add |local to remaining components without breaking ToggleButton usage by splitting transition: into in:/out: and only applying to out:. Resolves #51
1 parent a6c6530 commit 14a3c57

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

src/lib/components/Backdrop.svelte

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,29 @@
22
import { fade, FadeParams } from 'svelte/transition';
33
44
import portalAction from '../actions/portal';
5+
import { cls } from '../utils/styles';
56
67
export let blur: boolean = false;
78
export let portal = false;
89
910
export let fadeParams: FadeParams = { duration: 300 };
1011
</script>
1112

12-
<!-- TODO: Add `|local` to transition without breaking `ToggleButton` usage: https://github.com/techniq/svelte-ux/issues/51 -->
1313
<div
14-
class="backdrop fixed top-0 bottom-0 left-0 right-0 flex items-center
15-
justify-center bg-black/50 {$$restProps.class || ''}"
14+
class={cls(
15+
'backdrop fixed top-0 bottom-0 left-0 right-0 flex items-center justify-center bg-black/50',
16+
blur && 'backdrop-blur-sm',
17+
$$restProps.class
18+
)}
1619
on:keydown
1720
on:keyup
1821
on:keypress
1922
on:click
2023
on:mousedown
2124
on:mouseup
22-
transition:fade={fadeParams}
23-
class:blur
25+
in:fade={fadeParams}
26+
out:fade|local={fadeParams}
2427
use:portalAction={{ enabled: portal }}
2528
>
2629
<slot />
2730
</div>
28-
29-
<style lang="postcss">
30-
.blur {
31-
backdrop-filter: blur(2px);
32-
}
33-
</style>

src/lib/components/Dialog.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,15 @@
9191
}}
9292
use:portalAction={{ enabled: portal }}
9393
>
94-
<!-- TODO: Add `|local` to transition without breaking `ToggleButton` usage: https://github.com/techniq/svelte-ux/issues/51 -->
9594
<div
9695
class={cls(
9796
'dialog rounded bg-white elevation-4 overflow-y-auto pointer-events-auto relative outline-none',
9897
classes.dialog,
9998
$$props.class
10099
)}
101100
style={$$props.style}
102-
transition:scale={{ duration: 150, easing: quadIn }}
101+
in:scale={{ duration: 150, easing: quadIn }}
102+
out:scale|local={{ duration: 150, easing: quadIn }}
103103
on:introstart
104104
on:outrostart
105105
on:introend

src/lib/components/Drawer.svelte

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
{portal}
4343
/>
4444

45-
<!-- TODO: Add `|local` to transition without breaking `ToggleButton` usage: https://github.com/techniq/svelte-ux/issues/51 -->
4645
<div
4746
class={cls(
4847
'bg-white fixed overflow-auto transform z-50 outline-none',
@@ -57,7 +56,11 @@
5756
$$props.class
5857
)}
5958
style={$$props.style}
60-
transition:fly={{
59+
in:fly={{
60+
x: left ? '-100%' : right ? '100%' : 0,
61+
y: top ? '-100%' : bottom ? '100%' : 0,
62+
}}
63+
out:fly|local={{
6164
x: left ? '-100%' : right ? '100%' : 0,
6265
y: top ? '-100%' : bottom ? '100%' : 0,
6366
}}

src/lib/components/Menu.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
on:close
5959
let:close
6060
>
61-
<!-- TODO: Add `|local` to transition without breaking `ToggleButton` usage: https://github.com/techniq/svelte-ux/issues/51 -->
6261
<!-- svelte-ignore a11y-click-events-have-key-events -->
6362
<menu
6463
class="menu-items outline-none max-h-screen"
@@ -68,7 +67,8 @@
6867
// Do not allow event to reach Popover's on:mouseup (clickOutside)
6968
e.stopPropagation();
7069
}}
71-
transition:transition={transitionParams}
70+
in:transition={transitionParams}
71+
out:transition|local={transitionParams}
7272
use:focusMove={{ disabled: !moveFocus }}
7373
>
7474
<slot {close} />

0 commit comments

Comments
 (0)