migrate: convert most components to svelte 5
This commit is contained in:
1 parent
d670f39f0a
commit
10ef4123da
225 files changed
+5441
-3341
No files matched your search
@@ -12,19 +12,37 @@
|
||||
size,
|
||||
} from '@floating-ui/core'
|
||||
|
||||
export let openOnHover: boolean = false
|
||||
export let open: boolean = false
|
||||
export let manual: boolean = false
|
||||
|
||||
export let placement: Placement = 'bottom-start'
|
||||
export let middleware: Middleware[] = [
|
||||
interface Props {
|
||||
openOnHover?: boolean;
|
||||
open?: boolean;
|
||||
manual?: boolean;
|
||||
placement?: Placement;
|
||||
middleware?: Middleware[];
|
||||
strategy?: Strategy;
|
||||
class?: string;
|
||||
target?: import('svelte').Snippet;
|
||||
children?: import('svelte').Snippet;
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
let {
|
||||
openOnHover = false,
|
||||
open = $bindable(false),
|
||||
manual = false,
|
||||
placement = 'bottom-start',
|
||||
middleware = [
|
||||
offset(6),
|
||||
shift({ padding: 6 }),
|
||||
flip(),
|
||||
]
|
||||
export let strategy: Strategy = 'absolute'
|
||||
let clazz: string = ''
|
||||
export { clazz as class }
|
||||
],
|
||||
strategy = 'absolute',
|
||||
class: clazz = '',
|
||||
target,
|
||||
children,
|
||||
...rest
|
||||
}: Props = $props();
|
||||
|
||||
</script>
|
||||
|
||||
<Popover
|
||||
@@ -33,23 +51,27 @@
|
||||
{middleware}
|
||||
{strategy}
|
||||
{manual}
|
||||
{...$$restProps}
|
||||
{...rest}
|
||||
bind:open
|
||||
popoverClass="backdrop-blur-xl rounded-xl w-full max-w-[280px]"
|
||||
class={clazz}
|
||||
>
|
||||
<slot name="target" slot="target" />
|
||||
<div
|
||||
slot="popover"
|
||||
class="w-full max-w-[280px] origin-top-left
|
||||
max-h-[32rem] overflow-auto list-none shadow-lg rounded-xl"
|
||||
>
|
||||
{#snippet target()}
|
||||
{@render target?.()}
|
||||
{/snippet}
|
||||
{#snippet popover()}
|
||||
<div
|
||||
class="flex flex-col py-2 list-none bg-white/80 dark:bg-zinc-900/80 px-2 gap-px
|
||||
rounded-xl
|
||||
border border-slate-200 dark:border-zinc-800 border-opacity-50"
|
||||
|
||||
class="w-full max-w-[280px] origin-top-left
|
||||
max-h-[32rem] overflow-auto list-none shadow-lg rounded-xl"
|
||||
>
|
||||
<slot />
|
||||
<div
|
||||
class="flex flex-col py-2 list-none bg-white/80 dark:bg-zinc-900/80 px-2 gap-px
|
||||
rounded-xl
|
||||
border border-slate-200 dark:border-zinc-800 border-opacity-50"
|
||||
>
|
||||
{@render children?.()}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/snippet}
|
||||
</Popover>
|
||||
Reference in new issue
Block a user