You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte-kit-vice/src/uix/terra/field/components/Field.Suffix.svelte

31 lines
745 B

<script lang="ts">
import { readableActive, writableActive, mergeProps } from "$terra/utils";
import type { FieldSuffixProps } from '../types';
import { FieldSuffixState } from '../field-state.svelte';
import { createId } from '$terra/utils';
const uid = $props.id();
let {
ref = $bindable(null),
id = createId(uid),
child,
children,
...restProps
}: FieldSuffixProps = $props();
const suffixState = FieldSuffixState.create({
id: readableActive(() => id),
ref: writableActive(() => ref, (v) => (ref = v)),
});
const mergedProps = $derived(mergeProps(suffixState.props, restProps));
</script>
{#if child}
{@render child({ props: mergedProps })}
{:else}
<span {...mergedProps}>
{@render children?.()}
</span>
{/if}

Powered by TurnKey Linux.