Type CheckboxGroup.svelte.
This commit is contained in:
parent
d4e63c0716
commit
aec4d4d8ac
|
@ -1,19 +1,19 @@
|
|||
<script>
|
||||
<script lang="ts" generics="O, V">
|
||||
import "@spectrum-css/fieldgroup/dist/index-vars.css"
|
||||
import "@spectrum-css/radio/dist/index-vars.css"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
|
||||
export let direction = "vertical"
|
||||
export let value = []
|
||||
export let options = []
|
||||
export let direction: "horizontal" | "vertical" = "vertical"
|
||||
export let value: V[] = []
|
||||
export let options: O[] = []
|
||||
export let disabled = false
|
||||
export let readonly = false
|
||||
export let getOptionLabel = option => option
|
||||
export let getOptionValue = option => option
|
||||
export let getOptionLabel: (option: O) => string = (option: O) => `${option}`
|
||||
export let getOptionValue: (option: O) => V = option => option as unknown as V
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
const dispatch = createEventDispatcher<{ change: V[] }>()
|
||||
|
||||
const onChange = optionValue => {
|
||||
const onChange = (optionValue: V) => {
|
||||
if (!value.includes(optionValue)) {
|
||||
dispatch("change", [...value, optionValue])
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue