2022-12-17 23:29:16 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
defineProps<{
|
|
|
|
label: string
|
|
|
|
hover?: boolean
|
|
|
|
}>()
|
|
|
|
const { modelValue } = defineModel<{
|
|
|
|
modelValue: boolean
|
|
|
|
}>()
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<label
|
|
|
|
class="common-checkbox flex items-center cursor-pointer py-1 text-md w-full gap-y-1"
|
2023-01-05 08:47:58 +00:00
|
|
|
:class="hover ? 'hover:bg-active ms--2 px-4 py-2' : null"
|
2022-12-17 23:29:16 +00:00
|
|
|
@click.prevent="modelValue = !modelValue"
|
|
|
|
>
|
2023-01-05 08:47:58 +00:00
|
|
|
<span flex-1 ms-2 pointer-events-none>{{ label }}</span>
|
2022-12-17 23:29:16 +00:00
|
|
|
<span
|
|
|
|
:class="modelValue ? 'i-ri:checkbox-line' : 'i-ri:checkbox-blank-line'"
|
2023-01-05 08:47:58 +00:00
|
|
|
text-lg
|
2022-12-17 23:29:16 +00:00
|
|
|
aria-hidden="true"
|
|
|
|
/>
|
|
|
|
<input
|
|
|
|
v-model="modelValue"
|
|
|
|
type="checkbox"
|
|
|
|
sr-only
|
|
|
|
>
|
|
|
|
</label>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.common-checkbox:focus-within {
|
|
|
|
outline: none;
|
|
|
|
border-bottom: 1px solid var(--c-text-base);
|
|
|
|
}
|
|
|
|
</style>
|