2021-03-31 11:59:07 +02:00
|
|
|
<script>
|
2021-04-15 12:50:56 +02:00
|
|
|
import Field from "./Field.svelte"
|
2021-04-15 20:28:08 +02:00
|
|
|
import TextField from "./Core/TextField.svelte"
|
2021-03-31 11:59:07 +02:00
|
|
|
import { createEventDispatcher } from "svelte"
|
|
|
|
|
2021-04-15 12:50:56 +02:00
|
|
|
export let value = null
|
|
|
|
export let label = null
|
|
|
|
export let labelPosition = "above"
|
|
|
|
export let placeholder = null
|
|
|
|
export let type = "text"
|
2021-03-31 11:59:07 +02:00
|
|
|
export let disabled = false
|
2021-04-19 15:04:07 +02:00
|
|
|
export let readonly = false
|
2021-04-15 12:50:56 +02:00
|
|
|
export let error = null
|
2021-05-18 09:37:07 +02:00
|
|
|
export let updateOnChange = true
|
2021-03-31 11:59:07 +02:00
|
|
|
|
2021-04-15 12:50:56 +02:00
|
|
|
const dispatch = createEventDispatcher()
|
|
|
|
const onChange = e => {
|
|
|
|
value = e.detail
|
2021-04-20 13:49:02 +02:00
|
|
|
dispatch("change", e.detail)
|
2021-03-31 11:59:07 +02:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2021-04-29 16:24:59 +02:00
|
|
|
<Field {label} {labelPosition} {error}>
|
2021-04-15 12:50:56 +02:00
|
|
|
<TextField
|
2021-05-18 09:37:07 +02:00
|
|
|
{updateOnChange}
|
2021-04-15 12:50:56 +02:00
|
|
|
{error}
|
|
|
|
{disabled}
|
2021-04-19 15:04:07 +02:00
|
|
|
{readonly}
|
2021-04-15 12:50:56 +02:00
|
|
|
{value}
|
|
|
|
{placeholder}
|
2021-03-31 11:59:07 +02:00
|
|
|
{type}
|
2021-04-19 15:04:07 +02:00
|
|
|
on:change={onChange}
|
2021-04-20 12:53:19 +02:00
|
|
|
on:click
|
2021-05-04 12:04:42 +02:00
|
|
|
on:input
|
2021-05-10 12:53:32 +02:00
|
|
|
on:blur
|
2021-05-18 09:37:07 +02:00
|
|
|
on:focus
|
2021-05-21 14:27:27 +02:00
|
|
|
on:keyup
|
2021-05-04 12:04:42 +02:00
|
|
|
/>
|
2021-04-15 12:50:56 +02:00
|
|
|
</Field>
|