checkbox: support undefined state
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script lang="ts" module>
|
||||
export type CheckboxState = 'indeterminate' | boolean;
|
||||
export type CheckboxState = 'indeterminate' | boolean | undefined;
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -21,7 +21,7 @@
|
||||
let {
|
||||
name,
|
||||
required = false,
|
||||
value = $bindable(false),
|
||||
value = $bindable(),
|
||||
color = 'contrast',
|
||||
class: classValue,
|
||||
children,
|
||||
@@ -37,7 +37,7 @@
|
||||
<input
|
||||
type="hidden"
|
||||
{name}
|
||||
value={value.toString()}
|
||||
value={value?.toString() ?? 'false'}
|
||||
use:validate={{
|
||||
valfunc: () => {
|
||||
if (required && value !== true) {
|
||||
|
||||
Reference in New Issue
Block a user