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
@@ -1,24 +1,37 @@
|
||||
<script lang="ts">
|
||||
let forID: string | undefined = undefined
|
||||
export { forID as for }
|
||||
/**
|
||||
|
||||
|
||||
interface Props {
|
||||
for?: string | undefined;
|
||||
/**
|
||||
* The `text` prop will take precedence over the slot.
|
||||
*/
|
||||
export let text: string | undefined = undefined
|
||||
let clazz: string = ''
|
||||
export { clazz as class }
|
||||
text?: string | undefined;
|
||||
class?: string;
|
||||
children?: import('svelte').Snippet;
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
let {
|
||||
for: forID = undefined,
|
||||
text = undefined,
|
||||
class: clazz = '',
|
||||
children,
|
||||
...rest
|
||||
}: Props = $props();
|
||||
|
||||
</script>
|
||||
|
||||
<svelte:element
|
||||
this={forID ? 'label' : 'span'}
|
||||
{...$$restProps}
|
||||
{...rest}
|
||||
for={forID}
|
||||
class="text-sm text-slate-800 dark:text-zinc-200 font-medium w-full {clazz ||
|
||||
''}"
|
||||
>
|
||||
{#if text}
|
||||
{text}
|
||||
{:else if $$slots.default}
|
||||
<slot />
|
||||
{:else if children}
|
||||
{@render children?.()}
|
||||
{/if}
|
||||
</svelte:element>
|
||||
Reference in new issue
Block a user