2021-03-31 11:59:07 +02:00
|
|
|
<script>
|
2021-04-16 18:12:22 +02:00
|
|
|
import Field from "./Field.svelte"
|
|
|
|
import Switch from "./Core/Switch.svelte"
|
|
|
|
import { createEventDispatcher } from "svelte"
|
|
|
|
|
|
|
|
export let value = null
|
|
|
|
export let label = null
|
|
|
|
export let labelPosition = "above"
|
|
|
|
export let text = null
|
2021-03-31 11:59:07 +02:00
|
|
|
export let disabled = false
|
2021-04-16 18:12:22 +02:00
|
|
|
export let error = null
|
2021-03-31 11:59:07 +02:00
|
|
|
|
2021-04-16 18:12:22 +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
|
|
|
}
|
2021-04-16 18:12:22 +02:00
|
|
|
</script>
|
2021-03-31 11:59:07 +02:00
|
|
|
|
2021-04-29 16:24:59 +02:00
|
|
|
<Field {label} {labelPosition} {error}>
|
2021-04-16 18:12:22 +02:00
|
|
|
<Switch {error} {disabled} {text} {value} on:change={onChange} />
|
|
|
|
</Field>
|