Allow indeterminate booleans

This commit is contained in:
Adria Navarro 2023-06-07 14:48:03 +01:00
parent 7c39946584
commit 615d825817
2 changed files with 6 additions and 2 deletions

View File

@ -10,6 +10,7 @@
export let validate = null
export let compress = false
export let lighter = false
export let indeterminate = false
const dispatch = createEventDispatcher()
@ -34,7 +35,7 @@
on:click={onChange}
>
<span>
<Checkbox {disabled} {value} />
<Checkbox {disabled} {value} {indeterminate} />
</span>
<div class="text">
{#if text}

View File

@ -9,6 +9,7 @@
export let text = null
export let disabled = false
export let size
export let indeterminate = false
const dispatch = createEventDispatcher()
const onChange = event => {
@ -19,7 +20,9 @@
</script>
<label
class="spectrum-Checkbox spectrum-Checkbox--emphasized {sizeClass}"
class="spectrum-Checkbox spectrum-Checkbox--emphasized {sizeClass} {indeterminate
? 'is-indeterminate'
: ''}"
class:is-invalid={!!error}
class:checked={value}
>