prep: replace $$props.class with props
This commit is contained in:
1 parent
3ca72662ca
commit
0718c8e0c6
69 files changed
+383
-214
No files matched your search
@@ -23,6 +23,8 @@
|
||||
flip(),
|
||||
]
|
||||
export let strategy: Strategy = 'absolute'
|
||||
let clazz: string = ''
|
||||
export { clazz as class }
|
||||
</script>
|
||||
|
||||
<Popover
|
||||
@@ -34,7 +36,7 @@
|
||||
{...$$restProps}
|
||||
bind:open
|
||||
popoverClass="backdrop-blur-xl rounded-xl w-full max-w-[280px]"
|
||||
class={$$props.class}
|
||||
class={clazz}
|
||||
>
|
||||
<slot name="target" slot="target" />
|
||||
<div
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
export let alignment: ButtonAlignment = 'left'
|
||||
export let href: string | undefined = undefined
|
||||
export let disabled: boolean = false
|
||||
let clazz: string = ''
|
||||
export { clazz as class }
|
||||
</script>
|
||||
|
||||
<Button
|
||||
@@ -19,7 +21,7 @@
|
||||
? 'opacity-70 pointer-events-none cursor-not-allowed'
|
||||
: ''} {color == 'tertiary'
|
||||
? 'hover:dark:bg-zinc-800/70'
|
||||
: ''} duration-100 {$$props.class}"
|
||||
: ''} duration-100 {clazz}"
|
||||
{alignment}
|
||||
{href}
|
||||
{disabled}
|
||||
|
||||
@@ -62,6 +62,10 @@
|
||||
floatingRef(node)
|
||||
}
|
||||
}
|
||||
|
||||
export let popoverClass: string = ''
|
||||
let clazz: string = ''
|
||||
export { clazz as class }
|
||||
</script>
|
||||
|
||||
<svelte:body
|
||||
@@ -92,9 +96,7 @@
|
||||
}}
|
||||
role="menu"
|
||||
type="button"
|
||||
class="{canUseContents
|
||||
? 'contents text-left'
|
||||
: 'w-max h-max'} {$$props.class}"
|
||||
class="{canUseContents ? 'contents text-left' : 'w-max h-max'} {clazz}"
|
||||
bind:this={el}
|
||||
use:customFloatingRef
|
||||
>
|
||||
@@ -106,7 +108,7 @@
|
||||
<Portal class="z-[150]">
|
||||
<div
|
||||
transition:scale={{ duration: 200, start: 0.96, easing: backOut }}
|
||||
class="z-[150] {$$props.popoverClass}"
|
||||
class="z-[150] {popoverClass}"
|
||||
use:customFloatingContent
|
||||
use:focusTrap
|
||||
>
|
||||
|
||||
@@ -1,34 +1,37 @@
|
||||
<script lang="ts">
|
||||
import { browser } from '$app/environment'
|
||||
import { browser } from '$app/environment'
|
||||
|
||||
// https://github.com/sveltejs/svelte/issues/3088#issuecomment-505785516
|
||||
import { onMount, onDestroy, createEventDispatcher } from 'svelte'
|
||||
let slottedElements: HTMLDivElement, portal: HTMLDivElement
|
||||
// https://github.com/sveltejs/svelte/issues/3088#issuecomment-505785516
|
||||
import { onMount, onDestroy, createEventDispatcher } from 'svelte'
|
||||
let slottedElements: HTMLDivElement, portal: HTMLDivElement
|
||||
|
||||
const dispatch = createEventDispatcher<{ mounted: void }>()
|
||||
const dispatch = createEventDispatcher<{ mounted: void }>()
|
||||
|
||||
onMount(() => {
|
||||
if (!browser) return
|
||||
portal = document?.createElement('div')
|
||||
if (portal) portal.className = 'portal-mount'
|
||||
document?.body.appendChild(portal)
|
||||
portal?.appendChild(slottedElements)
|
||||
dispatch('mounted')
|
||||
})
|
||||
onMount(() => {
|
||||
if (!browser) return
|
||||
portal = document?.createElement('div')
|
||||
if (portal) portal.className = 'portal-mount'
|
||||
document?.body.appendChild(portal)
|
||||
portal?.appendChild(slottedElements)
|
||||
dispatch('mounted')
|
||||
})
|
||||
|
||||
onDestroy(() => {
|
||||
portal.remove()
|
||||
})
|
||||
onDestroy(() => {
|
||||
portal.remove()
|
||||
})
|
||||
|
||||
let clazz: string = ''
|
||||
export { clazz as class }
|
||||
</script>
|
||||
|
||||
<div class="portal-initial-mount-point">
|
||||
<div bind:this={slottedElements} class="portal-content {$$props.class || ''}">
|
||||
<slot />
|
||||
</div>
|
||||
<div bind:this={slottedElements} class="portal-content {clazz || ''}">
|
||||
<slot />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.portal-initial-mount-point {
|
||||
display: none;
|
||||
}
|
||||
.portal-initial-mount-point {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user