2022-12-18 08:29:16 +09: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-01 23:29:11 +09:00
|
|
|
:class="hover ? 'hover:bg-active ms--2 ps-4' : null"
|
2022-12-18 08:29:16 +09:00
|
|
|
@click.prevent="modelValue = !modelValue"
|
|
|
|
>
|
|
|
|
<span
|
|
|
|
:class="modelValue ? 'i-ri:checkbox-line' : 'i-ri:checkbox-blank-line'"
|
|
|
|
aria-hidden="true"
|
|
|
|
/>
|
|
|
|
<input
|
|
|
|
v-model="modelValue"
|
|
|
|
type="checkbox"
|
|
|
|
sr-only
|
|
|
|
>
|
2023-01-01 23:29:11 +09:00
|
|
|
<span ms-2 pointer-events-none>{{ label }}</span>
|
2022-12-18 08:29:16 +09:00
|
|
|
</label>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.common-checkbox:focus-within {
|
|
|
|
outline: none;
|
|
|
|
border-bottom: 1px solid var(--c-text-base);
|
|
|
|
}
|
|
|
|
</style>
|