Comparing version 0.1.4 to 0.1.5
{ | ||
"name": "sveltik", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"repository": "git@github.com:mapgrid/sveltik.git", | ||
@@ -5,0 +5,0 @@ "author": "mapgrid <noreply@mapgrid.org>", |
@@ -346,5 +346,18 @@ # Sveltik | ||
**MyInput.svelte** | ||
```html | ||
<script> | ||
export let field | ||
</script> | ||
<input {...field} on:input={field.handleInput} on:blur={field.handleBlur} /> | ||
``` | ||
**App.svelte** | ||
```html | ||
<script> | ||
import { Sveltik, Form, Field } from 'sveltik' | ||
import MyInput from './MyInput.svelte' | ||
</script> | ||
@@ -355,3 +368,3 @@ | ||
<Sveltik | ||
initialValues={{ email: '', color: 'red', firstName: '' }} | ||
initialValues={{ email: '', color: 'red', firstName: '', lastName: '' }} | ||
onSubmit={(values, actions) => { | ||
@@ -372,5 +385,11 @@ setTimeout(() => { | ||
<Field name="lastName" let:field let:meta> | ||
<Field name="firstName" let:field let:meta> | ||
<div> | ||
<input type="text" placeholder="Email" {...field} /> | ||
<input | ||
type="text" | ||
placeholder="Jon" | ||
{...field} | ||
on:input={field.handleInput} | ||
on:blur={field.handleBlur} | ||
/> | ||
{#if meta.touched && meta.error} | ||
@@ -381,2 +400,4 @@ <div className="error">{meta.error}</div> | ||
</Field> | ||
<Field name="lastName" placeholder="Doe" as={MyInput} /> | ||
<button type="submit">Submit</button> | ||
@@ -383,0 +404,0 @@ </Form> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
501561
16008
422