Stop coercing all values to strings when using CoreCheckboxGroup
This commit is contained in:
parent
9231b58116
commit
e2fcd757f7
|
@ -13,9 +13,8 @@
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
const onChange = e => {
|
const onChange = optionValue => {
|
||||||
const optionValue = e.target.value
|
if (!value.includes(optionValue)) {
|
||||||
if (e.target.checked && !value.includes(optionValue)) {
|
|
||||||
dispatch("change", [...value, optionValue])
|
dispatch("change", [...value, optionValue])
|
||||||
} else {
|
} else {
|
||||||
dispatch(
|
dispatch(
|
||||||
|
@ -39,10 +38,9 @@
|
||||||
class="spectrum-Checkbox spectrum-Checkbox--sizeM spectrum-FieldGroup-item"
|
class="spectrum-Checkbox spectrum-Checkbox--sizeM spectrum-FieldGroup-item"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
on:change={onChange}
|
on:change={() => onChange(optionValue)}
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
class="spectrum-Checkbox-input"
|
class="spectrum-Checkbox-input"
|
||||||
value={optionValue}
|
|
||||||
checked={value.includes(optionValue)}
|
checked={value.includes(optionValue)}
|
||||||
{disabled}
|
{disabled}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue