Skip to content

Commit

Permalink
Merge pull request #17 from milahu/patch-5
Browse files Browse the repository at this point in the history
actually fix the binding from label to input
  • Loading branch information
AlexxNB authored Dec 16, 2020
2 parents cc0a3b2 + 71c4de2 commit 40a49ae
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cmp/Field.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import {current_component} from 'svelte/internal';
export let label = false;
export let labelAfter = false;
export let error = false;
export let success = false;
export let grouped = false;
Expand All @@ -15,8 +16,6 @@
const state = writable('');
let message = false;
let slot_wrapper;
setContext('field:state',state);
$: if(gapless) grouped = true;
Expand All @@ -37,9 +36,18 @@

<div class:nomessage={!message} use:events {...$$restProps}>
{#if label}
<label for={slot_wrapper.id}>{label}</label>
<label>
<p class="label">{label}</p>
<p class:grouped class:gapless><slot/></p>
</label>
{:else if labelAfter}
<label>
<p class:grouped class:gapless><slot/></p>
<p class="label">{labelAfter}</p>
</label>
{:else}
<p class:grouped class:gapless><slot/></p>
{/if}
<p bind:this={slot_wrapper} class:grouped class:gapless><slot/></p>
{#if message}
<p class="message" class:text-error={error} class:text-success={success}>{message}</p>
{:else}
Expand Down

0 comments on commit 40a49ae

Please sign in to comment.