File size: 906 Bytes
e2820d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<script lang="ts">
	import { BaseCheckbox } from "@gradio/checkbox";

	let {
		value = $bindable(false),
		editable = true,
		on_change
	}: {
		value?: boolean;
		editable?: boolean;
		on_change: (value: boolean) => void;
	} = $props();

	function handle_change(val: boolean): void {
		if (editable) {
			on_change(val);
		}
	}
</script>

<div class="bool-cell" role="button" tabindex="-1">
	<BaseCheckbox
		bind:value
		label=""
		interactive={editable}
		on_change={handle_change}
	/>
</div>

<style>
	.bool-cell {
		display: flex;
		align-items: center;
		justify-content: center;
		width: min-content;
		height: var(--size-full);
		margin: 0 auto;
	}

	.bool-cell :global(input:disabled) {
		cursor: not-allowed;
	}

	.bool-cell :global(label) {
		margin: 0;
		width: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.bool-cell :global(span) {
		display: none;
	}
</style>