File size: 1,290 Bytes
0bd62e5 |
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 |
<script lang="ts">
import { createEventDispatcher } from "svelte";
export let value: boolean;
export let disabled: boolean;
const dispatch = createEventDispatcher<{ change: boolean }>();
</script>
<input
bind:checked={value}
on:input={() => dispatch("change", !value)}
type="checkbox"
{disabled}
class:disabled={disabled && !value}
/>
<style>
input {
--ring-color: transparent;
position: relative;
box-shadow: var(--input-shadow);
border: 1px solid var(--checkbox-border-color);
border-radius: var(--radius-xs);
background-color: var(--checkbox-background-color);
line-height: var(--line-sm);
width: 18px !important;
height: 18px !important;
}
input:checked,
input:checked:hover,
input:checked:focus {
border-color: var(--checkbox-border-color-selected);
background-image: var(--checkbox-check);
background-color: var(--checkbox-background-color-selected);
}
input:hover {
border-color: var(--checkbox-border-color-hover);
background-color: var(--checkbox-background-color-hover);
}
input:focus {
border-color: var(--checkbox-border-color-focus);
background-color: var(--checkbox-background-color-focus);
}
.disabled {
opacity: 0.8 !important;
cursor: not-allowed;
}
</style>
|