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